[Bug] Anthropic API Error: Missing Tool Result Block for Tool Invocation

Resolved 💬 3 comments Opened Sep 20, 2025 by pm0code Closed Jan 8, 2026

Bug Description

Claude Code API Error Bug Report

Summary

Claude Code session crashed with API Error 400 due to tool invocation state management issue.

Error Details

API Error: 400 {
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "messages.132: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01X86WqYofYGZVrVCF3fmdsp. Each `tool_use` block must have a corresponding `tool_result` block in the next message."
  },
  "request_id": "req_011CTLK3eXvtizDuxrMT3b9V"
}

Environment

  • Platform: Windows 11 x64
  • Claude Code Version: Latest (as of 2025-09-20)
  • Session Length: 132 messages (extended conversation)
  • Working Directory: Local development project

Reproduction Context

  • Extended conversation session with multiple tool invocations
  • Use of parallel agent execution patterns
  • Complex multi-step development workflow
  • Session involved file operations, code analysis, and system management

Expected Behavior

Tool invocations should complete successfully or gracefully handle failures without corrupting conversation state.

Actual Behavior

  • Tool invocation initiated (ID: toolu_01X86WqYofYGZVrVCF3fmdsp)
  • No corresponding tool_result received
  • API rejected entire conversation as malformed
  • Complete session termination requiring restart

Impact

  • Loss of conversation context and session state
  • Interruption of development workflow
  • Need to restart and rebuild context

Frequency

First observed instance, but conversation depth (132 messages) suggests potential correlation with extended sessions.

Potential Contributing Factors

  1. Extended conversation length (100+ messages)
  2. Multiple parallel tool executions
  3. Complex file system operations
  4. Network timeout or resource constraints
  5. Windows-specific session management

Suggested Investigation Areas

  • Tool execution timeout handling
  • Conversation state synchronization
  • Message ordering validation
  • Resource management in extended sessions
  • Platform-specific session handling (Windows)

Workaround

Restart Claude Code session and rebuild necessary context.

Additional Notes

Error occurred during active development session involving multiple agents and complex tool orchestration. Session was functioning normally until sudden termination.

Environment Info

  • Platform: win32
  • Terminal: null
  • Version: 1.0.120
  • Feedback ID: 411227ad-f200-48be-86f3-5db0467694af

Errors

[{"error":"Error: EISDIR: illegal operation on a directory, read\n    at Module.readFileSync (node:fs:441:20)\n    at Object.readFileSync (file:///C:/Users/Nader/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:719:6848)\n    at x9B (file:///C:/Users/Nader/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3563:9983)\n    at Object.call (file:///C:/Users/Nader/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1724:978)\n    at call.next (<anonymous>)\n    at VJ5 (file:///C:/Users/Nader/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3350:21057)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async WNB (file:///C:/Users/Nader/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3350:17339)\n    at async f9B (file:///C:/Users/Nader/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1729:3422)\n    at async rJB (file:///C:/Users/Nader/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1972:1631)","timestamp":"2025-09-20T21:01:06.851Z"},{"error":"AbortError: The operation was aborted\n    at abortChildProcess (node:child_process:749:27)\n    at AbortSignal.onAbortListener (node:child_process:819:7)\n    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:827:20)\n    at AbortSignal.dispatchEvent (node:internal/event_target:762:26)\n    at runAbort (node:internal/abort_controller:486:10)\n    at abortSignal (node:internal/abort_controller:457:3)\n    at AbortController.abort (node:internal/abort_controller:505:5)\n    at Timeout._onTimeout (file:///C:/Users/Nader/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:3566:75)\n    at listOnTimeout (node:internal/timers:588:17)\n    at process.processTimers (node:internal/timers:523:7)","timestamp":"2025-09-20T21:01:57.573Z"}]

View original on GitHub ↗

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