[BUG]
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Creating a Routine (via desktop app: Customize → More → Routines → New local routine) fails 100% of the time with the toast "Failed to save routine. You can try again." The same failure reproduces via the scheduled-tasks MCP tool's create_scheduled_task call inside a Claude Code session, with the underlying error "path moved between validation and open".
This is not caused by antivirus, file permissions, OneDrive, or org policy: writing a file directly to the exact same path the app fails on (C:\Users\<user>\.claude\scheduled-tasks\<taskId>\SKILL.md) succeeds instantly with no interference. The bug appears to be a race condition in the app's own save logic between a path-validation step and the subsequent open-for-write step.
What Should Happen?
The routine/scheduled task should save successfully, writing its full frontmatter and prompt content to SKILL.md, and then appear in the Routines list / list_scheduled_tasks output.
Error Messages/Logs
Desktop UI toast: Failed to save routine. You can try again.
CLI tool error (identical underlying cause):
Failed to create scheduled task: path moved between validation and open
Steps to Reproduce
- Open Claude desktop app → Customize → More → Routines → New local routine.
- Fill in Name, Description, Instructions (any values), leave trigger as Manual/Daily, set a working directory (e.g.
C:\Temp\test). - Click Create.
- Observe error toast: "Failed to save routine. You can try again."
- Repeat with a different name — same result every time.
Equivalent reproduction via Claude Code session (no desktop UI needed):
- Call the scheduled-tasks MCP tool's create_scheduled_task with any taskId, prompt, description, and a cronExpression.
- Observe: Failed to create scheduled task: path moved between validation and open.
- Inspect C:\Users\<user>\.claude\scheduled-tasks\<taskId>\: a directory and an empty (0-byte) SKILL.md were created, but the content write never completed.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.275 (Claude Code) — desktop app
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
- Ruled out CrowdStrike Falcon/antivirus interference: manually writing to the exact failing path succeeded with no issues.
- Ruled out file permission issues: ACLs on .claude\scheduled-tasks are standard (SYSTEM/Administrators/user, full control).
- Ruled out OneDrive sync: .claude is a plain local directory, not OneDrive-redirected or symlinked.
- Ruled out org/workspace policy: the org-level "Routines" feature toggle is enabled (Default: on), and no local managed-settings.json policy exists on this machine.
- Every failed attempt leaves an orphaned empty directory + 0-byte SKILL.md under .claude\scheduled-tasks\<taskId>\, which list_scheduled_tasks correctly ignores as invalid, but which are never cleaned up automatically.