Effect CommunityEC
Effect Community7mo ago
8 replies
James Birtles

Error with Tool Calling in Anthropic Client: Missing `tool_use` Block

is tool calling working in the anthropic client?
i'm getting an error when trying to continue the conversation, i've added a log to get the full message out of the body and its:
{"type":"error","error":{"type":"invalid_request_error","message":"messages.2.content.0: unexpected `tool_use_id` found in `tool_result` blocks: toolu_01MMBhdt6jywoRZEod75WGYR. Each `tool_result` block must have a corresponding `tool_use` block in the previous message."}}


Looking at the exported chat it seems like its missing the first part of the tool call (see screenshot). The exact same setup works with the openai client
image.png
Was this page helpful?