Month 13 is out of bounds?
This error is logged on iOS 11 and on macOS 10.13 for sure and I'm not seeing it cause any specific function or problem on any platform.
I'll link to the main question here about "does macOS log too much" since that's an opinion and impression that is worthy of discussion. Some people might feel better if there were no messages unless a really serious condition needs action. Others want even more detail so they can know what's happening / learn / measure. So, it's going to be a tradeoff how these are issues / categorized / used.
- Fresh macOS install: Console.app displays errors/faults. Is that to be expected?
One interesting developer that has some tools is Howard Oakley who blogs at https://eclecticlight.co/
His downloads page has two apps of interest (use the left downloads link as the product versions below are beta and may not be current in a day or week):
- Consolation - an alternative console browser
- Woodpile - a tool to count / bin / analyze patterns of logging
I can verify the legitimacy of this problem. I had the same issue yesterday, and after a restart, the computer was rendered almost useless due to this error. For some reason, the computer can't deal with this month and throws errors wherever there are databases or plists.
To fix this:
Open Activity Monitor and force quit two processes:
lsd
,UserEventAgent
Open System Preferences and navigate to "Date & Time"
Uncheck "Set date and time automatically"
In the calendar, select a date prior to December 2017 and press Save
If
UserEventAgent
orlsd
continue to cause problems, then force quit them again after setting the date.
Other people here have this problem
Why?
It seems to me, UserEventAgent was attempting to use two plist files:
System/Library/LaunchAgents/com.apple.UserEventAgent-Aqua.plist
and
System/Library/LaunchAgents/com.apple.UserEventAgent-LoginWindow.plist
When it tried to use the plists, it got an error:
Month 13 is out of bounds
I'm not sure what actually happened within UserEventAgent, but it's obvious that when it gets the error, it cannot deal with it and causes high CPU and RAM usage.
I had the same issue with extremely high UserEventAgent CPU and memory usage starting at the beginning of December 2017. Console showed the "month out of bounds" error as described above.
I tried disk utility "first aid," reboots, safe mode (to clear system cache), clearing NVRAM and SMD, nothing helped. I did notice that the CPU and memory usage didn't spike in safe mode.
Like @tgray and u/kidtexas, at some point I figured out that if I disabled all my custom launchd plists that the problem didn't occur.
I eventually wrote the little script below to help me debug which plist was causing the issue. It ended up being a plist that runs on the first of every month:
<key>StartCalendarInterval</key>
<dict>
<key>Day</key>
<integer>1</integer>
<key>Hour</key>
<integer>03</integer>
<key>Minute</key>
<integer>00</integer>
</dict>
Many of my plists use the StartCalendarInterval
key, and using the script below I could show that they didn't seem to cause the spiking RAM and memory issues, so it's not entirely clear to me why one specific plist cause the problem. Regardless, this is how I sorted it out.
I strongly recommend readers look through the script to try to understand what it does instead of just copy and paste. Specifically, as written this will only work for plists in ~/Library/LaunchAgents
(not /Library/LaunchDaemons
and others), and it intentionally only tests plists whose filename and <key>Label</key>
follow the specific pattern: com.USERNAME.my_plist_name[.plist]
. Before running it, I used a one-liner to bootout
all of my plists: for plist in com."$(whoami)".*.plist; do launchctl bootout gui/"${MYUID}"/"${plist%.plist}" || true; done
, and then verified they no longer appeared under launchctl list
results.
#! /bin/bash
# https://apple.stackexchange.com/questions/307512/month-13-is-out-of-bounds
set -euf -o pipefail
MYUID="$(id -u)"
pushd "${HOME}"/Library/LaunchAgents
while IFS= read -r -d '' plist; do
echo "${plist}"
stats=($(ps ux | grep -v grep | grep UserEventAgent | awk '{ print $3, $5}'))
cpu="${stats[0]}"
vmem="${stats[1]}"
echo "CPU use and virtual memory size while disabled: ${stats[@]}"
launchctl bootstrap gui/"${MYUID}" "${plist}"
sleep 5
stats=($(ps ux | grep -v grep | grep UserEventAgent | awk '{ print $3, $5}'))
echo "CPU use and virtual memory size while enabled: ${stats[@]}"
echo "Change in vmem: $(( "${vmem}" - "${stats[1]}" ))"
echo
done < <(find . -iname "com.$(whoami).*.plist" -print0)
popd
Like others, I was having high CPU usage and huge RAM usage from UserEventAgent (see my comment above). Changing the date to November and force quitting UserEventAgent fixed things. This all started on Saturday after I rebooted.
Fix
I figured this out for me. Hopefully for others with issues, this will work for you.
The issue was a LaunchAgent plist I have in ~/Library/LaunchAgents. It's a simple plist file that calls StartCalendarInterval, which is a valid key for launchd plists. The LaunchAgent job calls a shell script that copies some files to a backup location on the first day of the month. The job is not being called at all - I think it is launchd checking the loaded jobs against the Calendar which is causing the issue. As soon as I unloaded this plist and moved the file out of the directory, UserEventAgent was fine (after a force quit). The second I loaded the plist (launchctl load xxxx), UserEventAgent went nuts.
StartCalendarInterval is a valid key for launchd as seen here in Apple's docs.
So for anyone having issues, check your LaunchAgent directories and looks for the StartCalendarInterval key (or any other calendar related key). I did not have any issues with the time based interval plists.
Note: This doesn't fix the 'Month 13 out of bounds' errors, just the crazy UserEventAgent behavior.