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

  1. Use Claude Code to write a .gitignore file with standard patterns (build artifacts, IDE files, etc.)
  2. File writes successfully, but immediately followed by content filter error
  3. All subsequent operations fail with tool_use_id mismatch errors
  4. 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

  1. Standard .gitignore content should not trigger content filtering
  2. If content filter triggers, session should recover gracefully rather than corrupting state
  3. 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

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗