[BUG] API Error 400 "tool use concurrency issues" occurs only in print mode (-p), not in interactive mode
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?
When running Claude Code in print mode (-p flag), even simple commands like echo hello fail with "API Error: 400 due to tool use concurrency issues."
This error does NOT occur in interactive mode - only in print/pipeable mode.
I'm aware that #11421 is still open for the same error message, but that issue describes a different scenario:
- #11421: Occurs in interactive mode during parallel tool execution (3 Bash commands running simultaneously)
- This issue: Occurs in print mode (
-p) with simple prompts likeecho hello, with NO parallel tool execution involved
Since this appears to be a print-mode-specific manifestation of the underlying issue (and print mode was not covered in #11421 or the many closed duplicates like #8763, #9433, #9103, #9002, #15261), I'm filing a new issue to track this specific case.
What Should Happen?
Claude Code should execute simple commands in print mode without API errors, just as it does in interactive mode.
Error Messages/Logs
~ via 🥟 v1.3.6
❯ claude -p --dangerously-skip-permissions "echo hello"
API Error: 400 due to tool use concurrency issues.
~ via 🥟 v1.3.6 took 9s
❯ claude -p "echo hello"
API Error: 400 due to tool use concurrency issues.
Steps to Reproduce
- Open terminal
- Run
claude -p "echo hello"orclaude -p --dangerously-skip-permissions "echo hello" - Observe the 400 error
Note: The same prompt works fine in interactive mode (claude without -p).
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.7
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- This appears to be a print-mode-specific issue, as interactive mode works without problems
- Multiple MCP servers are configured, but the error occurs even with minimal prompts
- Related open issue: #11421 (different scenario - interactive mode with parallel tools)
- Related closed issues: #8763, #9433, #9103, #9002, #15261
5 Comments
Same issue here with v2.1.19.
Reproduction command
Error: "messages.1.content.1: tool_use ids must be unique"
Note: High cache_read_input_tokens values suggest prompt caching may be involved. Error occurs on first message of brand new sessions.
Env: Claude Code version (2.1.19), macOS
Adding another repro + environment for print mode failure.
Environment
Behavior
Repro
claude --dangerously-skip-permissions -p "Use Read tool to read ./README.md" --output-format stream-json --verboseWorkaround
Extra
claude doctorhangs at "Checking installation status..." here.Same issue, but it seems related to calling our Claude instance with the -p flag while in planning mode.
Still experiencing this on v2.1.19 (Jan 25, 2026). Error:
messages.1.content.2: tool_use ids must be uniqueConfirmed workaround: downgrade to v2.1.17 via
npm install -g @anthropic-ai/claude-code@2.1.17 --forceNote: Homebrew installation overrides npm global, so
brew uninstall claude-codemay be needed first.Same issue. Thanks for filing.
I'm seeing this error in an orchestrator that programmatically spawns claude -p sessions in parallel (up to 20 concurrent processes). The workflow has two phases:
This worked reliably until the last few days. What changed:
This is a different reproduction pattern from single-session usage — high parallelism + session resumption after unclean exits.