#PDF Input + subsequent tool calls failing

1 messages · Page 1 of 1 (latest)

ornate craterBOT
#

I'm an AI assistant - my answers may be incorrect and I cannot see screenshots. Please verify information with the OpenRouter docs.

To help debug this issue, I need the following details:

  • What is the full error message or failure response you're seeing after the next call?
  • What exact model identifier are you using (e.g. openai/gpt-3.5-turbo, anthropic/claude-3.5-sonnet)?
  • Can you share a relevant code snippet or JSON payload for both the tool call and the follow-up message that's failing?

This will help pinpoint if it's a model compatibility, schema, or formatting issue and makes it easier for mods to escalate if needed.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding.

The author you are looking for could not be found.

solid vortex
#

Anthropic error message: "messages.2.content.0: unexpected tool_use_id found in tool_result blocks: toolu_01BLzUhqM7TxMrF5qoqNWQV1. Each tool_result block must have a corresponding tool_use block in the previous message."

OpenAI error message: "No tool call found for function call output with call_id call_Bzx8BVVl3XNRlqZIJRBUyc23."

We do pass the annotations back as per the docs too.

ornate craterBOT
#

Thank you for the detailed error messages. These are critical clues.

Anthropic error:
"messages.2.content.0: unexpected tool_use_id found in tool_result blocks: toolu_01BLzUhqM7TxMrF5qoqNWQV1. Each tool_result block must have a corresponding tool_use block in the previous message."

OpenAI error:
"No tool call found for function call output with call_id call_Bzx8BVVl3XNRlqZIJRBUyc23."

Here’s what these mean and where the problem likely lies:

  • Both errors indicate a mismatch between the tool call ID in your tool output and the tool call that the model issued in the previous step.
  • For OpenAI/Anthropic models, the tool call "ID" (e.g., toolu_..., call_...) in your tool result message must exactly match one issued by the model in its prior message's tool_calls array.

Per the docs: "You'd want to check the finish_reason before processing tool calls... The LLM responds with a finish reason of tool_calls, and a tool_calls array. ... process the requested tool calls... messages.append({ 'role': 'tool', 'tool_call_id': tool_call.id, 'content': json.dumps(tool_response) })"
Tool Calling Docs

Please double-check these:</br>

  • Are you matching the tool_call_id in your tool message ("role": "tool", "tool_call_id": ...) to the model's issued tool call in the previous response?</br>
  • Are you sure you're not including extra fields? (For Anthropic, make sure you only use expected content fields.)</br>
  • Are your messages in this order: user, assistant/tool_call, tool, assistant? (Maintaining strict alternation is required.)

If PDF tools (like mistral-ocr file-parser plugin) behave differently, it's possible their tool call IDs or schema are slightly inconsistent with the expected O...

#

...penAI/Anthropic flow. But you must ensure tool results are tied directly to the issued tool call ID and no tool result appears without a matching tool call.

For full compliance, review the examples and message formats in the Tool & Function Calling docs, making sure your code matches message structure, key names, and ID passing exactly.

If everything matches and this persists, let me know:

  • The full sequence of JSON messages (redacted of private info) for user → assistant(tool_call) → tool(result) → assistant (fail).

This will help pinpoint message assembly problems.

-# This is an automated response powered by Answer HQ. Use !mute to stop the bot from responding.

solid vortex
#

finish_reason is tool calls and the LLM produced a tool calls array. The tool_call_id matches the tool call id from the array as well.

#

Here is a simplified/redacted request body that fails consistently on sonnet4.5/gpt5x