Skip to content

[BUG] Error breaks task permanently tool_use ids were found without tool_result blocks immediately after ... #1259

Description

@nh2

Describe the bug

I managed to get the error

Unknown Error: The model returned the following errors: messages.216: tool_use ids were found without tool_result blocks immediately after: tooluse_NudlJpcjeQemU5wudkIYMA. Each tool_use block must have a corresponding tool_result block in the next message.

Error details reveal this LLM JSON conversation:

    {
      "role": "assistant",
      "content": [
        {
          "type": "text",
          "text": "The visual confirms it: ..."
        },
        {
          "type": "tool_use",
          "id": "tooluse_UDLZ6mSXfpiIeVAHk5NnIR",
          "name": "execute_command",
          "input": {
            "command": "WS=/...",
            "cwd": "/mydir",
            "timeout": 300
          }
        },
        {
          "type": "tool_use",
          "id": "tooluse_NudlJpcjeQemU5wudkIYMA",
          "name": "execute_command",
          "input": {
            "command": "git diff --stat -- python/",
            "cwd": "/mydir",
            "timeout": 60
          }
        }
      ],
      "ts": 1786886475271
    },
    {
      "role": "user",
      "content": [
        {
          "type": "tool_result",
          "tool_use_id": "tooluse_UDLZ6mSXfpiIeVAHk5NnIR",
          "content": "{\"status\":\"approved\",\"feedback\":\"Indeed it looks good\"}\n\nCommand executed in terminal within working directory '/mydir'. Exit code: 0\nOutput:\n...\n"
        },
        {
          "type": "image",
          "source": {
            "type": "base64",
            "media_type": "image/png",
            "data": "iVBOR...="
          }
        },
        {
          "type": "tool_result",
          "tool_use_id": "tooluse_NudlJpcjeQemU5wudkIYMA",
          "content": "Command executed in terminal within working directory '/mydir'. Exit code: 0\nOutput:\n python/...\n"
        },
        {
          "type": "text",
          "text": "<user_message>\nSomething wrong with the tool use?\n</user_message>"
        },
        {
          "type": "text",
          "text": "<environment_details>\n# VSCode Visible Files\n...</environment_details>"
        }
      ],
      "ts": 1786886726851
    }

It seems like both tool_use requests from the LLM were provided an appropriate output by Zoo code, yet that error occurs.

This breaks the task permanently and seems irrecoverable from the GUI.

Screenshots

Image

What version of zoo are you running

3.76.0 and 3.78.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions