Apple - 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:

  1. Open Activity Monitor and force quit two processes: lsd, UserEventAgent

  2. Open System Preferences and navigate to "Date & Time"

  3. Uncheck "Set date and time automatically"

  4. In the calendar, select a date prior to December 2017 and press Save

  5. If UserEventAgent or lsd 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