claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Anthropic API Error: Invalid Content Block Type After MCP Tool Cancellation

Open thuanpham582002 opened this issue 1 year ago • 3 comments

Bug Description got 422 error after cancel mcp tool ⎿ API Error: 422 {"detail":[{"type":"string_type","loc":["body","messages",54,"content","s tr"],"msg":"Input should be a valid string","input":[{"tool_use_id":"call_wmpl7qfnw8","t ype":"tool_result"},{"type":"text","text":"\nThe TodoWrite tool hasn't been used recently. If you're working on tasks that would benefit from tracking progress, consider using the TodoWrite tool to track progress. Also consider cleaning up the todo list if has become stale and no longer matches what you are working on. Only use it if it's relevant to the current work. This is just a gentle reminder - ignore if not applicable.\n\n"},{"type":"text","text":"[Request interrupted by user for tool use]"},{"type":"text","text":"xxxx ","cache_control":{"type":"ephemeral"}}]},{"type":"literal_error","loc":["body","message s",54,"content","list[union[ClaudeContentBlockText,ClaudeContentBlockThinking,ClaudeCont entBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlockToolResult]]",0,"ClaudeContent BlockText","type"],"msg":"Input should be 'text'","input":"tool_result","ctx":{"expected ":"'text'"}},{"type":"missing","loc":["body","messages",54,"content","list[union[ClaudeC ontentBlockText,ClaudeContentBlockThinking,ClaudeContentBlockImage,ClaudeContentBlockToo lUse,ClaudeContentBlockToolResult]]",0,"ClaudeContentBlockText","text"],"msg":"Field required","input":{"tool_use_id":"call_wmpl7qfnw8","type":"tool_result"}},{"type":"liter al_error","loc":["body","messages",54,"content","list[union[ClaudeContentBlockText,Claud eContentBlockThinking,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlo ckToolResult]]",0,"ClaudeContentBlockThinking","type"],"msg":"Input should be 'thinking'","input":"tool_result","ctx":{"expected":"'thinking'"}},{"type":"missing","lo c":["body","messages",54,"content","list[union[ClaudeContentBlockText,ClaudeContentBlock Thinking,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlockToolResult] ]",0,"ClaudeContentBlockThinking","thinking"],"msg":"Field required","input":{"tool_use_id":"call_wmpl7qfnw8","type":"tool_result"}},{"type":"missi ng","loc":["body","messages",54,"content","list[union[ClaudeContentBlockText,ClaudeConte ntBlockThinking,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlockTool Result]]",0,"ClaudeContentBlockThinking","signature"],"msg":"Field required","input":{"tool_use_id":"call_wmpl7qfnw8","type":"tool_result"}},{"type":"liter al_error","loc":["body","messages",54,"content","list[union[ClaudeContentBlockText,Claud eContentBlockThinking,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlo ckToolResult]]",0,"ClaudeContentBlockImage","type"],"msg":"Input should be 'image'","input":"tool_result","ctx":{"expected":"'image'"}},{"type":"missing","loc":["b ody","messages",54,"content","list[union[ClaudeContentBlockText,ClaudeContentBlockThinki ng,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlockToolResult]]",0," ClaudeContentBlockImage","source"],"msg":"Field required","input":{"tool_use_id":"call_wmpl7qfnw8","type":"tool_result"}},{"type":"liter al_error","loc":["body","messages",54,"content","list[union[ClaudeContentBlockText,Claud eContentBlockThinking,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlo ckToolResult]]",0,"ClaudeContentBlockToolUse","type"],"msg":"Input should be 'tool_use'","input":"tool_result","ctx":{"expected":"'tool_use'"}},{"type":"missing","lo c":["body","messages",54,"content","list[union[ClaudeContentBlockText,ClaudeContentBlock Thinking,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlockToolResult] ]",0,"ClaudeContentBlockToolUse","id"],"msg":"Field required","input":{"tool_use_id":"call_wmpl7qfnw8","type":"tool_result"}},{"type":"missi ng","loc":["body","messages",54,"content","list[union[ClaudeContentBlockText,ClaudeConte ntBlockThinking,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlockTool Result]]",0,"ClaudeContentBlockToolUse","name"],"msg":"Field required","input":{"tool_use_id":"call_wmpl7qfnw8","type":"tool_result"}},{"type":"missi ng","loc":["body","messages",54,"content","list[union[ClaudeContentBlockText,ClaudeConte ntBlockThinking,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlockTool Result]]",0,"ClaudeContentBlockToolUse","input"],"msg":"Field required","input":{"tool_use_id":"call_wmpl7qfnw8","type":"tool_result"}},{"type":"missi ng","loc":["body","messages",54,"content","list[union[ClaudeContentBlockText,ClaudeConte ntBlockThinking,ClaudeContentBlockImage,ClaudeContentBlockToolUse,ClaudeContentBlockTool Result]]",0,"ClaudeContentBlockToolResult","content"],"msg":"Field required","input":{"tool_use_id":"call_wmpl7qfnw8","type":"tool_result"}}]}

Environment Info

  • Platform: darwin
  • Terminal: tmux
  • Version: 1.0.115
  • Feedback ID:

Errors


Note: Error logs were truncated.

thuanpham582002 avatar Sep 16 '25 03:09 thuanpham582002

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/3003
  2. https://github.com/anthropics/claude-code/issues/6836

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Sep 16 '25 03:09 github-actions[bot]

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 05 '25 10:12 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Jan 02 '26 14:01 github-actions[bot]