Crash (`NSInvalidArgumentException: Calendar must be nil or Gregorian`) when setting a due date on non-Gregorian locale (`calendar=iso8601`)

Open Beginner friendly
#120 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
macos, swift
Domain
cli

Research direction

Start in RemindCore's RemindersStore, at createReminder(_:target:) and updateReminder(id:), where the crash log shows setDueDateComponents being called; find where the due-date DateComponents are built and which calendar they inherit from Calendar.current/autoupdatingCurrent. Reproduce by setting defaults write NSGlobalDomain AppleLocale "en_US@calendar=iso8601" and running remindctl add "Test" --due "2026-11-21", then verify the fix by setting a due date both with ISO 8601 and Gregorian locales and confirming the reminder stores the right date. Done means due-date commands succeed under a non-Gregorian locale without regressing the Gregorian path.

Written by the indexing model from the issue text.

Description

clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:crash-loop issue-rating: 🦞 diamond lobster no-stale P1

Bug report for github.com/openclaw/remindctl

generated by Lumo plus

Title: Crash (NSInvalidArgumentException: Calendar must be nil or Gregorian) when setting a due date on non-Gregorian locale (calendar=iso8601)


Summary

Any remindctl operation that sets a due date crashes with an uncaught
NSInvalidArgumentException from EventKit:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: 'Calendar must be nil or Gregorian'

Operations without a due date (add, edit --title, complete, show/list) work fine.
This happens with every due-date variant I tried (today, absolute date, date+time),
on both add and edit.

Environment
  • macOS version: 27.3 — Apple Silicon
  • remindctl version: 0.3.9
  • Installed via: brew install steipete/tap/remindctl
  • Relevant locale setting:
$ defaults read NSGlobalDomain AppleLocale
en_CH@calendar=iso8601

The system calendar is set to ISO 8601 (Settings → General → Language & Region),
not Gregorian.

Steps to reproduce
  1. Set system locale to a non-Gregorian calendar, e.g.:
    defaults write NSGlobalDomain AppleLocale "en_US@calendar=iso8601" (or use System Settings)
  2. Run any due-date-setting command:
remindctl add "Test" --due "2026-11-21"
# or
remindctl edit <id> --due "2026-11-21"
# or
remindctl add "Test" --due today
Expected behavior

Reminder is created/updated with the given due date.

Actual behavior

Process aborts (Abort trap: 6), no reminder is written.

Crash log
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Calendar must be nil or Gregorian'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000018551e790 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x000000018112c64c objc_exception_throw + 88
	2   EventKit                            0x00000001ae7425f4 -[EKReminder(Shared) setDueDateComponents:] + 888
	3   remindctl                           0x0000000104e4afa0 $s10RemindCore14RemindersStoreC14createReminder_6targetAA0F4ItemVAA0F5DraftV_AA0F10ListTargetOtYaKFTY0_ + 672
	4   remindctl                           0x0000000104e1c935 $s9remindctl10AddCommandO4specAA0C4SpecVvgZy9Commander12ParsedValuesV_AA14RuntimeOptionsVtYaYbKcfU_TQ5_ + 1
	5   remindctl                           0x0000000104e1cf01 $s9remindctl10AddCommandO4specAA0C4SpecVvgZy9Commander12ParsedValuesV_AA14RuntimeOptionsVtYaYbKcfU_TATQ0_ + 1
	6   remindctl                           0x0000000104e1812d $s9remindctl13CommandRouterV3run4argvs5Int32VSaySSG_tYaFTQ1_ + 1
	7   remindctl                           0x0000000104e3b081 $sIetH_yts5Error_pIegHrzo_TR10async_MainTf3npf_nTQ2_ + 1
	8   libswift_Concurrency.dylib          0x00000001853ade69 _ZL22completeTaskAndReleasePN5swift12AsyncContextE + 0
)
libc++abi: terminating due to uncaught exception of type NSException

(The identical crash occurs in RemindersStore.updateReminder(id:...) for remindctl edit --due.)

Analysis

EventKit's -[EKReminder setDueDateComponents:] throws when the
NSDateComponents.calendar is neither nil nor a Gregorian NSCalendar.
With a system locale like en_CH@calendar=iso8601, the calendar picked up via
Calendar.current / autoupdatingCurrent is NSCalendarIdentifierISO8601, so any
due-date assignment aborts.

Likely fix: when constructing DateComponents for due dates, either leave
components.calendar = nil, or normalize the calendar explicitly to
Calendar(identifier: .gregorian) (keeping the user's timezone) before passing
the components to EventKit.

A defensive alternative is converting the crash into a graceful error, but
normalizing to Gregorian would actually fix the feature for non-Gregorian locales.

Workaround

None found via remindctl itself; due dates can be set in Reminders.app, or via a
different tool (e.g. keith/reminders-cli — untested whether it shares the code path).
Removing @calendar=iso8601 from the locale restores functionality but changes
system-wide calendar display.

Dominant language
Swift
Stars
428
Forks
86
Avg merge
20m
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openclaw/remindctl

All issues in openclaw/remindctl

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.