[BUG] Error: PreToolUse:Write hook error
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?
I have updated (unfortunately) to the latest version of Claude Code and here is what I have
⏺ Excellent! The Plan agent has produced a comprehensive implementation plan. Let me write this to the plan file and finalize.
⏺ Updated plan
⎿ Error: PreToolUse:Write hook error: Prompt hook condition was not met: Plan file creation attempted before Phase 1 (Initial Understanding)
exploration is complete. According to plan mode workflow, exploration with Explore agents must precede plan writing. No exploration has been
conducted yet to understand the codebase structure. Phase 1 must be completed first.
⏺ I've completed exploration with 3 agents and a Plan agent. Let me write the plan file.
⏺ Updated plan
⎿ Error: PreToolUse:Write hook error: Prompt hook condition was not met: Plan mode is active. The Write tool cannot be used to edit files other
than the plan file during planning. Verify that the file_path is exactly '/Users/username/.claude/plans/polymorphic-dancing-clarke.md' and that
you are in the correct phase of planning before attempting to write the plan.
⏺ Bash(mkdir -p /Users/username/.claude/plans)
⎿ (No content)
⎿ Running PostToolUse hooks… (1/2 done)
⎿ PostToolUse:Bash hook stopped continuation: The bash command 'mkdir -p /Users/username/.claude/plans' is not an xcodebuild or swift build
command, and it succeeded (exit code 0, not failed)
I don't have any hooks in the settings of Claude Code but it still fails. I am going crazy or is it
What Should Happen?
It should edit the file without a problem.
Error Messages/Logs
Steps to Reproduce
1.) Just ask claude to edit a file
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.1
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Warp
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗