Invalid tool_use name (>200 chars) persisted to transcript poisons the session with 400 on every later request
Environment
- Claude Code v2.1.273 (CLI, iTerm2), model Sonnet 5, macOS 26.6.2
What happened
The model emitted a tool_use block whose name was an entire shell command (201 characters). The client tried to execute it, returned No such tool available: <command>, and wrote the block to the session .jsonl. Every subsequent request then failed with:
API Error: 400 messages.212.content.2.tool_use.name: String should have at most 200 characters
Sending "continue" fails the same way. claude --resume replays the block and fails too. The only recovery was starting a new session, which loses the working context.
Measured on the transcript
73 tool_use blocks in the session file, exactly one with an invalid name (201 characters, one over the API limit).
Expected
- Validate
tool_usenames client-side and drop or repair the block before persisting it to the transcript, or - Repair invalid blocks (and their paired
tool_result) on--resumeso the session can continue.
Notes/bug is disabled in this environment via CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1, hence the manual report. No transcript content attached; only the counts above.