Skip to content

Invalid Tool Result Block: Missing Corresponding Tool Result After Tool Use #2672

@jorgeuriarte

Description

@jorgeuriarte

Bug Description
probably due to a connection error, sometimes the conversation gets stuck with: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.167: tool_use ids were found without tool_result blocks immediately
after: toolu_01AxtNfsQwHEvRUTRnvcyxTn. Each tool_use block must have a corresponding tool_result block in the next message."}}

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 1.0.35
  • Feedback ID: 244f1c3e-b2ce-4653-af6b-d11141359f7e

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at TZ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:700:3921)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:9014\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:17199)\n    at VX (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:8160)\n    at nS (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:7241)\n    at f9 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:11408)","timestamp":"2025-06-27T16:54:07.996Z"},{"error":"Error: Tool list_expenses not found\n    at xR2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1923:5554)\n    at uE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n    at tT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:42555)\n    at rT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38104)\n    at _$ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38032)\n    at YU (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:37886)\n    at oW (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:34976)\n    at y5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:4822)\n    at t8 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:32232)\n    at A.Q.updateContainer (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:1835)","timestamp":"2025-06-27T16:54:08.629Z"},{"error":"Error: Tool test_unified_connection not found\n    at xR2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1923:5554)\n    at uE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n    at tT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:42555)\n    at rT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38104)\n    at _$ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38032)\n    at YU (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:37886)\n    at oW (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:34976)\n    at y5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:4822)\n    at t8 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:32232)\n    at A.Q.updateContainer (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:86:1835)","timestamp":"2025-06-27T16:54:08.637Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at eD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:1184)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:912\n    at Array.map (<anonymous>)\n    at mK (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1469:903)\n    at vR2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1923:9268)\n    at uE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n    at tT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:42555)\n    at rT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38104)\n    at _$ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38032)\n    at YU (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:37886)","timestamp":"2025-06-27T16:54:08.639Z"},{"error":"Error: Tool list_expenses not found\n    at xR2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1923:5554)\n    at uE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n    at tT (file:///opt/homebrew/lib/nod

Note: Error logs were truncated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiarea:corebugSomething isn't workingduplicateThis issue or pull request already existshas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    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