Skip to content

API Request Failure: Unexpected 400 Bad Request Error #4159

@pablopda

Description

@pablopda

Bug Description
Some error in the tool use return 400 from the API

Environment Info

  • Platform: linux
  • Terminal: vscode
  • Version: 1.0.27
  • Feedback ID: c151882c-9404-4cf4-9750-02be0facbbf8

Errors

[{"error":"SyntaxError: Unexpected token '/', \"/home/arka\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:573:9976\n    at Q (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:526:17199)\n    at B2A.<anonymous> (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2462:3044)\n    at B2A.B [as _actionHandler] (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:516:528)\n    at file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:520:3127\n    at B2A._chainOrCall (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:520:1694)\n    at B2A._parseCommand (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:520:3103)\n    at B2A.parseAsync (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:517:4195)\n    at m$5 (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2474:1659)","timestamp":"2025-07-22T13:02:08.402Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.103: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01BxWhiVKyTW2HM42hmKNkVH, toolu_01Gj1re23uAztExKcG3QAqQj, toolu_01TAuEAwbE4eZzkXpsx5RpVS. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"}}\n    at h6.generate (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1300:12578)\n    at Tw.makeStatusError (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1315:2082)\n    at Tw.makeRequest (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1315:5257)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async CE2.$11.showErrors (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:22068)\n    at async $11 (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:12173)\n    at async CE2 (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:21914)\n    at async file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:17073\n    at async ut1 (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:5121)\n    at async Ku (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:17043)","timestamp":"2025-07-22T13:29:39.809Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.103: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01BxWhiVKyTW2HM42hmKNkVH, toolu_01Gj1re23uAztExKcG3QAqQj, toolu_01TAuEAwbE4eZzkXpsx5RpVS. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"}}\n    at h6.generate (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1300:12578)\n    at Tw.makeStatusError (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1315:2082)\n    at Tw.makeRequest (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1315:5257)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async CE2.$11.showErrors (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:22068)\n    at async $11 (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:12173)\n    at async CE2 (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:21914)\n    at async file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:17073\n    at async ut1 (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:5121)\n    at async Ku (file:///home/arkat/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1670:17043)","timestamp":"2025-07-22T20:57:48.050Z"}]

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