Content filter on .gitignore causes cascading tool_use_id errors and session crash
Resolved 💬 2 comments Opened Dec 11, 2025 by hyperpolymath Closed Dec 12, 2025
Description
Writing a standard .gitignore file triggers "Output blocked by content filtering policy" error, which then corrupts conversation state causing repeated "unexpected tool_use_id found in tool_result blocks" errors. Session becomes unrecoverable without /clear or restart.
Steps to reproduce
- Use Claude Code to write a
.gitignorefile with standard patterns (build artifacts, IDE files, etc.) - File writes successfully, but immediately followed by content filter error
- All subsequent operations fail with tool_use_id mismatch errors
- Session cannot recover - requires full restart
Error messages
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Output blocked by content filtering policy"},"request_id":null}
Followed by:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.2.content.3: unexpected tool_use_id found in tool_result blocks: toolu_01L257ZxCuGz2Pq6sqbAyNdw. Each tool_result block must have a corresponding tool_use block in the previous message."},"request_id":"req_011CVzxL3rTxnnUAJBLo3kee"}
Expected behavior
- Standard
.gitignorecontent should not trigger content filtering - If content filter triggers, session should recover gracefully rather than corrupting state
- Tool call/result state should remain synchronized after API errors
Environment
- OS: Fedora 43 (Linux 6.17.9-300.fc43.x86_64)
- Claude Code version: 2.0.65
- Model: claude-opus-4-5-20251101
Related issues
#4210, #11064, #9433, #6948
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗