anthropics / anthropic-quickstarts

A collection of projects designed to help developers quickly get started with building deployable applications using the Anthropic API
MIT License
6.97k stars 1.04k forks source link

[computer use] stuck with BadRequestError #134

Open ronnyli opened 1 month ago

ronnyli commented 1 month ago
Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.32: Did not find 2 tool_result block(s) at the beginning of this message. Messages following tool_use blocks must begin with a matching number of tool_result blocks.'}}

Here is message 32

{"role":"user","content":[{"type":"text","text":"Click on the phone number field","cache_control":{"type":"ephemeral"}}]}

Is there a way for me to edit the messages to remove the bad entry before sending?

p-i- commented 1 month ago

This is a duplicate of https://github.com/anthropics/anthropic-quickstarts/issues/121 although your title is arguably better as it addresses the root rather than the trigger.