[BUG] Scheduled tasks silently disappear: recurring task vanished twice in 5 days while spent one-time tasks persist
Environment
- Claude Code desktop app on Windows 11 Pro (10.0.26200)
- Scheduled tasks created/managed via the
scheduled-tasksMCP tools (create_scheduled_task/update_scheduled_task/list_scheduled_tasks), stored as{taskId}/SKILL.mdunder~/.claude/scheduled-tasks/
What happened
A recurring scheduled task (daily cron 0 9 * * *, notifyOnCompletion default) silently disappeared from the scheduler twice within 5 days, with no user action:
- First occurrence (~Jul 29): the recurring task and an unrelated future one-time task both vanished.
list_scheduled_tasksno longer returned them; the agent discovered the loss only because an expected daily run never happened. Recreated the recurring task same day. - Second occurrence (~Aug 3): the same recreated recurring task vanished again. Detected when
update_scheduled_taskreturnedScheduled task "<id>" not found.list_scheduled_tasksat that moment returned only two already-fired one-time tasks (enabled: false, withlastRunAt) — the active recurring task was gone.
Pattern so far: spent one-time tasks survive; the active recurring task is the one that disappears. In both windows the app/session had been restarted at least once (a background shell task from the previous session also showed "no completion record ... may have been running when the previous Claude Code process exited"), so a crash/teardown during shutdown may be involved in cleanup of the tasks directory or its index.
Impact
The recurring task was the only automated monitor for a multi-day production data-backfill (reminding the operator of a critical manual step). Silent loss of a scheduled task = silent loss of monitoring — the failure mode is invisible until a human notices a missing report. We now defensively call list_scheduled_tasks before trusting that any watcher still exists, which defeats the purpose of scheduling.
Expected
Scheduled tasks should persist until explicitly deleted (or auto-disabled after firing, for one-time tasks). If a task is removed for any internal reason (corruption, migration, cleanup), there should be a visible trace/notification rather than silent disappearance.
Repro attempts
No deterministic repro found. Both losses happened across app restarts/session teardowns on Windows. Happy to provide timestamps/logs if you point me to where the scheduler persists its index.
4 Comments
The "recurring vanishes, one-time persists" asymmetry is a useful diagnostic signal. It suggests the deletion path is keyed on a condition that recurring tasks meet more often than one-time tasks — expiry evaluation after the last run, a TTL on tasks that have fired at least once, or a cleanup sweep that checks
nextRunAtand drops tasks whose computed next run has already passed (which could happen if the scheduler was paused, restarted, or behind during a previous cycle window).A few things that would help narrow it:
SKILL.mdfor the recurring task look like just before the second vanishing, specifically thelastRunAtandnextRunAtfields? IfnextRunAtis in the past at the time of disappearance, that points to the scheduled-past cleanup theory.~/.claude/scheduled-tasks/<taskId>/on disk, or only fromlist_scheduled_tasksoutput? If the directory is gone, the deletion is persistent; if the directory exists but the task isn't listed, it is a registration/reload gap.The silent disappearance without a log entry is the most actionable bug here regardless of root cause — a scheduled task that deletes itself should at minimum write a deletion reason to the task's audit trail.
Thanks — gathered what I could for all three questions. The disk evidence is conclusive on #2.
2. Disk vs listing: directories persist; the registration is what vanishes.
~/.claude/scheduled-tasks/still contains all 11 task directories ever created on this machine — including tasks that vanished fromlist_scheduled_tasksdays ago, and even tasks that were explicitly deleted via the API weeks ago. The recurring task,s directory was created Jul 27 and survived both vanishings (same directory; itsSKILL.mdwas simply overwritten when I re-created the task). So this is a registration/reload gap, not persistent deletion.Related finding: the task directory contains only
SKILL.md, whose frontmatter holds justname+description. None of the schedule metadata (cronExpression/fireAt/enabled/lastRunAt/nextRunAt/jitterSeconds— all of whichlist_scheduled_tasksreports) lives in the task directory, and I could not find an index file elsewhere under~/.claude. Wherever that registry is persisted is what is losing entries.1. State just before the second vanishing (from
list_scheduled_tasksoutputs, since SKILL.md carries no schedule fields):update_scheduled_taskon the recurring task returnednot found.So in both events,
nextRunAtpassed while the app was closed — consistent with your scheduled-past cleanup theory. One caveat: in event #1 a future one-time task (fireAtNov 3, months away) vanished in the same event, which the past-nextRunAttheory does not explain.A sharper asymmetry than recurring-vs-one-time: after each event, the survivors were exactly the disabled/spent tasks (
enabled: false, already fired). The tasks lost were exactly the active ones (recurring + future one-time). That smells like "the active/pending set fails re-registration on reload" while the spent set is either persisted differently or never touched.3. Version bumps: cannot confirm (no CLI access from this environment to check version history). Both windows did include app/session restarts, at least one non-graceful: background shell tasks from the prior session were reported with "no completion record ... may have been running when the previous Claude Code process exited".
Agreed on the audit trail point — a deletion reason written to the task directory (which demonstrably survives) would have made this diagnosable on the first occurrence.
Third occurrence — same recurring task, vanished again within ~24h of being re-created.
Timeline for this one (times UTC):
not foundon update → re-created from scratch (daily cron0 9 * * *, local BRT = 12:02 UTC).update_scheduled_task→Scheduled task "<id>" not foundagain.list_scheduled_tasksshows only the two spent one-time tasks, as before. Task directory +SKILL.mdstill on disk, as before.Pattern across all three: the active recurring task is lost within roughly one scheduled-fire window of its (re-)creation; spent one-time tasks are never affected. This machine typically has the app closed at the cron fire time on some days and open on others, and losses have followed both patterns now — so "nextRunAt in the past at reload" may not be the whole story, unless the relevant reload happens at unpredictable times (session teardown?).
Happy to run any diagnostic on the next re-creation — this reproduces reliably enough here (3/3 within ~5 days) that instrumentation would likely catch it in the act.
4th occurrence (2026-08-05, ~19:50 UTC, same Windows 11 machine).
Registry vs disk at discovery time:
list_scheduled_tasksreturned only 2 entries — both spent one-time tasks (lastRunAt Jul 28 and Aug 3), bothenabled: false.~/.claude/scheduled-tasks/still holds 11 task directories, everySKILL.mdintact.Lost from the registry (all previously active):
Pattern matches occurrences 1–3 exactly: directories and SKILL.md files persist, registry entries for active tasks vanish; the only survivors are already-spent one-time entries. Recovery was again trivial by re-creating from the on-disk SKILL.md files, which is why I can confirm the files themselves are untouched.
Happy to pull any local logs/paths that would help — just tell me what to grab before the next occurrence overwrites state.