I'm seeing the following error when using openhand...
# questions
l
I'm seeing the following error when using openhands cli and asking it to help me merge open PRs:
Copy code
Detail:
litellm.BadRequestError: BadRequestError: OpenrouterException - {"error":{"message":"Provider returned error","code":422,"metadata":{"raw":"{\"detail\":\[{\"type\":\"missing\",\"loc\":\[\"body\",\"messages\",5,\"content\"\],\"msg\":\"Field required\",\"input\":{\"role\":\"assistant\",\"tool_calls\":\[{\"id\":\"chatcmpl-tool-828c3dfedd7392c2\",\"type\":\"function\",\"function\":{\"name\":\"terminal\",\"arguments\":\"{\\\"command\\\": \\\"cd /home/alexc/Projects/ResumeProject/ResumeAI && git log origin/pr-issue-15 --oneline -365\\\", \\\"security_risk\\\": \\\"LOW\\\", \\\"summary\\\": \\\"Check even more commits on pr-issue-15\\\"}\"}}\]}},{\"type\":\"missing\",\"loc\":\[\"body\",\"messages\",7,\"content\"\],\"msg\":\"Field required\",\"input\":{\"role\":\"assistant\",\"tool_calls\":\[{\"id\":\"chatcmpl-tool-83015ac665f20ec5\",\"type\":\"function\",\"function\":{\"name\":\"terminal\",\"arguments\":\"{\\\"command\\\": \\\"cd /home/alexc/Projects/ResumeProject/ResumeAI && git log origin/pr-issue-15 --oneline -370\\\", \\\"security_risk\\\": \\\"LOW\\\", \\\"summary\\\": \\\"Check even more commits on pr-issue-15\\\"}\"}}\]}},{\"type\":\"missing\",\"loc\":\[\"body\",\"messages\",9,\"content\"\],\"msg\":\"Field required\",\"input\":{\"role\":\"assistant\",\"tool_calls\":\[{\"id\":\"chatcmpl-tool-8e34e4f000307052\",\"type\":\"function\",\"function\":{\"name\":\"terminal\",\"arguments\":\"{\\\"command\\\": \\\"cd /home/alexc/Projects/ResumeProject/ResumeAI && git log origin/pr-issue-15 --oneline -375\\\", \\\"security_risk\\\": \\\"LOW\\\", \\\"summary\\\": \\\"Check even more commits on pr-issue-15\\\"}\"}}\]}},{\"type\":\"missing\",\"loc\":\[\"body\",\"messages\",11,\"content\"\],\"msg\":\"Field required\",\"input\":{\"role\":\"assistant\",\"tool_calls\":\[{\"id\":\"chatcmpl-tool-9740370b20579bf7\",\"type\":\"function\",\"function\":{\"name\":\"terminal\",\"arguments\":\"{\\\"command\\\": \\\"cd /home/alexc/Projects/ResumeProject/ResumeAI && git log origin/pr-issue-15 --oneline -380\\\", \\\"security_risk\\\": \\\"LOW\\\", \\\"summary\\\": \\\"Check even more commits on pr-issue-15\\\"}\"}}\]}},{\"type\":\"missing\",\"loc\":\[\"body\",\"messages\",13,\"content\"\],\"msg\":\"Field required\",\"input\":{\"role\":\"assistant\",\"tool_calls\":\[{\"id\":\"chatcmpl-tool-83e7c8948cd8ff09\",\"type\":\"function\",\"function\":{\"name\":\"terminal\",\"arguments\":\"{\\\"command\\\": \\\"cd /home/alexc/Projects/ResumeProject/ResumeAI && git log origin/pr-issue-15 --oneline -385\\\", \\\"security_risk\\\": \\\"LOW\\\", \\\"summary\\\": \\\"Check even more commits on pr-issue-15\\\"}\"}}\]}},{\"type\":\"missing\",\"loc\":\[\"body\",\"messages\",15,\"content\"\],\"msg\":\"Field required\",\"input\":{\"role\":\"assistant\",\"tool_calls\":\[{\"id\":\"chatcmpl-tool-b723ae3e0a541a85\",\"type\":\"function\",\"function\":{\"name\":\"terminal\",\"arguments\":\"{\\\"command\\\": \\\"cd /home/alexc/Projects/ResumeProject/ResumeAI && git log origin/pr-issue-15 --oneline -390\\\", \\\"security_risk\\\": \\\"LOW\\\", \\\"summary\\\"...","provider_name":"Arcee AI","is_byok":false}},"user_id":"user_2jBw5IzoUjsCXdl1uudCse6vmLJ"}
c
@nutritious-balloon-65098 The OpenRouter error here is 422, what in this message is causing it? Also, what model is it?
n
I'm on it! can track my progress here.
- The
422
is caused by missing
content
fields
on several
assistant
messages that contain
tool_calls
. OpenRouter’s validator reports
Field required
at
body.messages[5].content
,
[7].content
,
[9].content
, etc., meaning those message objects include
role: "assistant"
and
tool_calls
, but omit
content
entirely
(it typically must be present, even if empty). - The model is not shown in the provided error text. The snippet only shows
provider_name: "Arcee AI"
(the upstream provider OpenRouter routed to), but not the actual OpenRouter
model
string. To identify the model you’d need the request config/log where the
model
parameter is set/printed.
- The OpenRouter
422
is caused by missing
content
fields
on multiple assistant messages in the request payload. The error explicitly points to
body.messages[5].content
,
[7].content
,
[9].content
,
[11].content
,
[13].content
, and
[15].content
being required but absent. Those messages are assistant messages that contain
tool_calls
but no
content
key
, which fails OpenRouter’s request validation. - Model: The snippet you provided does not include the OpenRouter
model
string, so the exact model cannot be determined from this error alone. The only model-related hint shown is
provider_name: "Arcee AI"
, which indicates the upstream provider OpenRouter routed to, not the configured model name. - How many messages: The payload had at least 16 messages (
messages[0]
through
messages[15]
), because the error references index
15
. It may have had more, but the excerpt only proves
>= 16
. - Tool calls + content: The failing messages shown in the error had tool_calls and were missing content (i.e., they did not have both). The error does not confirm whether other messages (not listed) had both
tool_calls
and
content
.
c
@lively-dusk-84740 Could you please tell the LLM you used? It's kind of strange that apparently multiple messages were missing content, did anything happen before, like, did you resume this conversation from another LLM perhaps?
l
I responded on the github issue