[Bug] /context command fails with: Anthropic API Error: Invalid message format with thinking blocks and tool use
Resolved 💬 7 comments Opened Dec 11, 2025 by rufinus Closed Feb 14, 2026
Bug Description
using "/context" leads to:
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.33.content.0.type: Expected `thinking` or `redacted_thinking`, but found `tool_use`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns.
Environment Info
- Platform: linux
- Terminal: vte-based
- Version: 2.0.65
- Feedback ID: f6302ca8-02b4-40a5-a830-5ad350cddde4
Errors
[{"error":"ZodError: [\n {\n \"code\": \"invalid_type\",\n \"expected\": \"object\",\n \"received\": \"undefined\",\n \"path\": [\n \"hooks\"\n ],\n \"message\": \"Required\"\n }\n]\n at get error (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:77:27070)\n at QJ.parse (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:77:20339)\n at zSB (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1067:278)\n at wSB (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1067:3214)\n at Ld3 (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1067:7453)\n at async qd3 (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1067:5709)\n at async file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1067:14558","timestamp":"2025-12-11T11:03:25.328Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"max_tokens: Extra inputs are not permitted\"},\"request_id\":\"req_011CVznfbLfrGrHZ13XvKY7c\"}\n at B9.generate (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:122:10379)\n at MR.makeStatusError (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:860:2195)\n at MR.makeRequest (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:860:5419)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1411:3503\n at async file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1411:2262\n at async oc3 (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1410:354)\n at async mxB (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1411:2195)\n at async xLA (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2082:52)\n at async kV8 (file:///home/ludwig/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2082:2358)","timestamp":"2025-12-11T11:03:31.619Z"}]This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗