Skip to content

Specific session always generates API Error 400 on each request #3639

@ChristophRauch

Description

@ChristophRauch

Bug Description
In a specific session, regardless what I type into Claude Code, I always get the following error:

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

When I start a new session, the problem is not there, so it must have something to do with the session itself?

Environment Info

  • Platform: linux
  • Terminal: gnome-terminal
  • Version: 1.0.53
  • Feedback ID: 139b954b-54b2-4162-9e7c-1f2a9c81ec2f

Errors

[{"error":"Error: Invalid settings at /home/christoph/.claude/settings.json: [\n  {\n    \"code\": \"unrecognized_keys\",\n    \"keys\": [\n      \"additionalDirectories\",\n      \"automation\"\n    ],\n    \"path\": [],\n    \"message\": \"Unrecognized key(s) in object: 'additionalDirectories', 'automation'\"\n  }\n]\n    at GoA (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:640:4370)\n    at gN9 (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:640:6078)\n    at Lq (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:640:6383)\n    at wQ (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:640:6318)\n    at Zl0 (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:747:5081)\n    at file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:758:1146\n    at Q (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:542:14406)\n    at rF4 (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2669:9917)\n    at file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2686:1373","timestamp":"2025-07-16T15:15:47.941Z"},{"error":"Error: Invalid settings at /home/christoph/.claude/settings.json: [\n  {\n    \"code\": \"unrecognized_keys\",\n    \"keys\": [\n      \"additionalDirectories\",\n      \"automation\"\n    ],\n    \"path\": [],\n    \"message\": \"Unrecognized key(s) in object: 'additionalDirectories', 'automation'\"\n  }\n]\n    at GoA (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:640:4370)\n    at NJ (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:640:5278)\n    at lx1 (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:614:1519)\n    at HrA (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:614:1480)\n    at ao2 (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2124:1245)\n    at mIA.<anonymous> (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2674:615)\n    at async mIA.parseAsync (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:533:4184)\n    at async eF4 (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2686:1216)\n    at async rF4 (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2669:10051)","timestamp":"2025-07-16T15:15:47.976Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01Ljs9UTjCKiGmLm9ymZPGrq. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"}}\n    at eQ.generate (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1180:6428)\n    at k$.makeStatusError (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1197:2101)\n    at k$.makeRequest (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1197:5315)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async aB1.showErrors (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2594:14107)\n    at async aB1 (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2140:1658)\n    at async qBB (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2594:13956)\n    at async file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2594:9065\n    at async DIA (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2594:1626)\n    at async Yp (file:///home/christoph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2594:9035)","timestamp":"2025-07-16T15:16:03.598Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01Ljs9UTjCKiGmLm9ymZPGrq. Each `tool_use` block must have a corresponding `tool_result` block in the next

Note: Error logs were truncated.

Metadata

Metadata

Assignees

Labels

area:apibugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

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