Skip to content

[Bug] Anthropic API Error: Missing Tool Result Block at 49k Context #6566

@harrism04

Description

@harrism04

Bug Description
It is throwing errors while we only used 49k of context. Here's the error:

\

Yes I can easily share sample requests that works and we can store them somewhere for reference?
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.166: tool_use ids were found without tool_result blocks immediately after:
toolu_01FRrDisJdFT12aPZ8bFg7Ew. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CSVgpHAZVCX7ZRiLMvB2g"}

Yes I can easily share sample requests that works and we can store them somewhere for reference?
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.166: tool_use ids were found without tool_result blocks immediately after:
toolu_01FRrDisJdFT12aPZ8bFg7Ew. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CSVgqiGCS3aJpRhbJDGt5"}

Yes I can easily share sample requests that works and we can store them somewhere for reference?
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.166: tool_use ids were found without tool_result blocks immediately after:
toolu_01FRrDisJdFT12aPZ8bFg7Ew. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CSVgt1jV2ZykcpKnu6W1h"}

Environment Info

  • Platform: darwin
  • Terminal: cursor
  • Version: 1.0.92
  • Feedback ID: 60e33653-2bce-4861-aee0-1086fa17bc86

Errors

[{"error":"Error: 1: 1 \n    at Gx6 (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1839:4892)\n    at async Qx6 (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1839:2187)","timestamp":"2025-08-26T03:45:52.729Z"},{"error":"Error: Request was aborted.\n    at R71._createMessage (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:934:7955)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-26T04:15:47.118Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.165: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01FRrDisJdFT12aPZ8bFg7Ew. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CSVgeL1SRCKJbfarCRNzt\"}\n    at b4.generate (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:926:2412)\n    at CP.makeStatusError (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:943:2101)\n    at CP.makeRequest (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:943:5314)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async vP (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1761:344)\n    at async FV5 (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2447:8414)\n    at async Promise.all (index 5)\n    at async wPB (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2447:8732)\n    at async Object.call (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2447:11081)\n    at async oN5 (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3175:1273)","timestamp":"2025-08-26T04:23:58.079Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.166: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01FRrDisJdFT12aPZ8bFg7Ew. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CSVgpHAZVCX7ZRiLMvB2g\"}\n    at b4.generate (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:926:2412)\n    at CP.makeStatusError (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:943:2101)\n    at CP.makeRequest (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:943:5314)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async YQB.yZ1.showErrors (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1898:27488)\n    at async yZ1 (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1898:16483)\n    at async YQB (file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1898:27318)\n    at async file:///Users/x/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1898:22272\n    at async bz0 (file:///Users/x/.claude/local/node_modules/@anthrop

Note: Error logs were truncated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions