anthropics / anthropics/claude-code
[BUG]
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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\\.claude\scheduled-tasks\\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
```shell
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
1. Open Claude desktop app → Customize → More → Routines → New local routine.
2. Fill in Name, Description, Instructions (any values), leave trigger as Manual/Daily, set a working directory (e.g. `C:\Temp\test`).
3. Click Create.
4. Observe error toast: "Failed to save routine. You can try again."
5. Repeat with a different name — same result every time.
Equivalent reproduction via Claude Code session (no desktop UI needed):
1. Call the scheduled-tasks MCP tool's create_scheduled_task with any taskId, prompt, description, and a cronExpression.
2. Observe: Failed to create scheduled task: path moved between validation and open.
3. Inspect C:\Users\\.claude\scheduled-tasks\\: 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\\, which list_scheduled_tasks correctly ignores as invalid, but which are never cleaned up automatically.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure through the desktop Routines flow and the scheduled-tasks MCP tool's create_scheduled_task call on Windows. Inspect the save path under .claude\scheduled-tasks and the validation-to-open sequence, including the orphaned empty SKILL.md. Done means a routine saves its complete content without the race error and appears in the Routines list or list_scheduled_tasks output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100