You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using claude --print mode with prompts that require tool usage (e.g., file reading), the CLI generates duplicate tool_use IDs, causing an API error 400.
Error Message
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.1: `tool_use` ids must be unique"},"request_id":"..."}
Steps to Reproduce
Run Claude CLI in print mode with a prompt requiring tool use:
claude --print --no-session-persistence "Read /path/to/file and summarize it"
The command fails with the above error
Expected Behavior
Claude should successfully read the file and return a summary.
Actual Behavior
API returns error 400 indicating tool_use IDs are not unique.
Additional Context
Simple prompts that don't require tools work fine:
claude --print --no-session-persistence "What is 1+1?"# Works
The issue occurs regardless of --no-session-persistence flag
Workaround: Using --tools "" to disable tools prevents the error, but also prevents Claude from using any tools
This appears to be a different issue from the tool_use/tool_result pairing issues in #6836 - this is specifically about duplicate ID generation.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
Activity
github-actions commentedon Jan 12, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.