API Error 400: tool_use ids without tool_result blocks in non-interactive (-p) mode

Resolved 💬 2 comments Opened Jan 24, 2026 by joelagnel Closed Jan 24, 2026

Description

When running Claude Code in non-interactive mode (-p flag), parallel tool calls cause an API Error 400 with the message about tool_use concurrency issues.

Steps to Reproduce

claude -p "/email:send_topic_digest"

Where /email:send_topic_digest is a custom command that triggers multiple parallel tool calls (e.g., spawning multiple research agents simultaneously).

Error Output

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tool_use ids without tool_result blocks: toolu_..."}}

Key Observations

  1. Only reproducible in non-interactive mode - The same command works fine when run interactively (without -p)
  2. The error occurs when Claude makes 3+ parallel tool calls
  3. Related to how the API expects sequential tool_use/tool_result pairs

Environment

  • Claude Code CLI
  • Linux

Related Issues

  • #8763 - Similar concurrency issues reported
  • #9433, #9103 - Related parallel tool call issues

Workaround Attempted

Adding instructions to CLAUDE.md to limit parallel tool calls did not reliably prevent the issue, as the model doesn't always follow such instructions.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗