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

オープン 初心者向け
#120 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
macos, swift
領域
cli

調査の方向性

RemindCore の RemindersStore の createReminder(_:target:) と updateReminder(id:) から始めます。ここではクラッシュログに setDueDateComponents が呼ばれていることが示されています。期限日の DateComponents がどこで構築され、どのカレンダーを Calendar.current/autoupdatingCurrent から継承しているかを見つけてください。defaults write NSGlobalDomain AppleLocale "en_US@calendar=iso8601" を設定し、remindctl add "Test" --due "2026-11-21" を実行して再現し、その後、ISO 8601 とグレゴリオ暦の両方のロケールで期限日を設定し、リマインダーが正しい日付を保存することを確認して修正を検証してください。完了とは、非グレゴリオ暦のロケール下で期限日コマンドが成功し、グレゴリオ暦の経路にリグレッションがないことを意味します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Swift
スター
428
フォーク
86
平均マージ
20分
マージ済み PR(30日)
5

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

openclaw/remindctl のほかの issue

openclaw/remindctl の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。