[BUG] 400 Error - Duplicate `tool_use` IDs on Single File Read
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?
Summary
Claude Code consistently returns 400 errors with "tool_use" ids must be unique even on single file read operations, making the tool completely unusable.
Environment
- OS: macOS
- Node version: v22.20.0
- Claude Code version: 2.1.19 (Claude Code)
- Package manager: pnpm
Minimal reproduction:
> Read src/components/ForgotPasswordModal.test.tsx
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.1: `tool_use` ids must be unique"},"request_id":"req_011CXWdJwusvyPauPWX3nGdg"}
What I've Tried (All Failed)
- [x]
/clearcommand - [x] New session
- [x]
rm -rf ~/.claude-code(nuclear option) - [x] Explicitly requesting single file reads with prompt: "Use tools one at a time to avoid 400 duplicate tool id issue"
- [x] Multiple restarts
Actual Behavior
Every file read operation fails with duplicate tool_use ID error, regardless of:
- Number of files being read
- Whether context is cleared
- Whether ~/.claude-code is deleted
Impact
Severity: P0/Blocker - Claude Code is completely unusable. Cannot perform any file operations.
Additional Context
The error message messages.1.content.1 suggests the ID collision is happening within the very first tool call of the first assistant message, indicating this is likely a bug in the tool call ID generation logic rather than accumulated state.
What Should Happen?
File read operations should succeed without tool ID collisions.
Error Messages/Logs
**First occurrence (multiple file reads):**
Read ForgotPasswordModal.test.tsx
Read Auth.test.tsx (lines 316-345)
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.2: `tool_use` ids must be unique"},"request_id":"req_011CXWckbtxmi9WTHDDu55aL"}
**Second occurrence (single file read):**
Read ForgotPasswordModal.test.tsx
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.1: `tool_use` ids must be unique"},"request_id":"req_011CXWdJwusvyPauPWX3nGdg"}
Steps to Reproduce
- Start a fresh Claude Code session
- Run
/clearto ensure clean context - Paste TypeScript errors and ask Claude Code to read a single file
- Observe 400 error
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Things were working the night before. Then started failing in the morning (not sure if there was auto-update). Then manual update still fails
Claude Code Version
2.1.19 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
Potentially Related Issue
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗