[BUG] --print mode generates duplicate tool_use IDs causing API error 400
Resolved 💬 1 comment Opened Jan 5, 2026 by kaidotio Closed Jan 5, 2026
Environment
- Claude CLI version: 2.0.76
- Operating System: Linux (Arch Linux 6.18.3)
- Terminal: tmux
Bug Description
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-persistenceflag - 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.
🤖 Generated with Claude Code
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗