[BUG] Plan agent cannot write plan file, state lost (but tokens billed) - UPDATE: both macOS and Windows
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?
Environment: Windows and macOS, VS Code UI extension
About 50% of the time a planning agent will spend several minutes spinning (writing the plan file) only for the Write tool to fail. The failure error isn't displayed to the end user, and typically the agent then exits giving the orchestrator a shorter version of the same. Meanwhile, I've been billed for about 100K tokens that just got doppred on the floor. In fact, that's more like 250K-500K tokens wasted because at that point, the planning agent exits, so all of the research -- all of the tool calls reading files and reasoning -- is gone, summarised in the limited handoff message that isn't persisted. Then, the orchestrator tries to make up for it by doing supplemental research, but it has no access to the findings of the planner agent.
Occasionally I'll get the first few lines of the accidentally-ephemeral plan shown in VS Code and have managed to select it and copy it into a text editor, but sometimes it's actually just blank.
<img width="1217" height="199" alt="Image" src="https://github.com/user-attachments/assets/3578c902-7846-4180-bccc-3060590c9c24" />
What Should Happen?
When the model generates text with the intent to write it to a file, the tooling system shouldn't just give up on the first attempt and give the user no recourse.
Error Messages/Logs
Steps to Reproduce
Have Claude deeply plan a complex area in Plan Mode. Unsure if this is related to Windows, could be realted to path separator chars.
I was using the Sonnet 4.5 1M model but I've also seen this with Opus 4.5
Claude Model
Other
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.5x
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
<img width="1217" height="199" alt="Image" src="https://github.com/user-attachments/assets/f7eedc39-2806-4941-8408-8b7726e07a92" />
This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗