Skip to content

[API Error: 400 invalid message content type: <nil>] (Press Ctrl+Y to retry) #3421

@rrhuffy

Description

@rrhuffy

What happened?

I'm aware of closed #3350 but in my case timeout and maxRetries didn't help

I noticed that after few interactions (this time after second prompt) it stops working and nothing works (Ctrl+Y, "continue", /btw etc.) and I need to close qwen-code and start it again with --resume
after setting mitmproxy I found that as some point request contains null content:

{
    "role":"assistant",
    "content":null,
    "reasoning_content":"Done … ."
},

when I change null into "something" and run request again via curl then it works fine
it matches previous model response which had:

…,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":"Done"},"finish_reason":null}]}
…
…,"choices":[{"index":0,"delta":{"role":"assistant","content":"","reasoning":"."},"finish_reason":null}]}
…,"choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":"stop"}]}
…,"choices":[],"usage":{"prompt_tokens":19300,"completion_tokens":40,"total_tokens":19340}}

I have "contextWindowSize": 32768 so it is not context window size problem

after restarting and typing "continue" I see that "reasoning_content" (but not "content") from previous "role":"assistant" responses is lost and the latest assistant response (the one with null content but existing reasoning_content) is lost completely (whole json object is missing in next request to ollama), and then everything works fine again

I think it's because of null content, and this is either because of small model (ollama's qwen3.5:9b) hallucination which returns reasoning but no content, or agent bug?
but because resuming works (by stripping incorrect assistant json block), it mean that there are null checks in place when resuming, just not in the middle of session, so that part could be improved

soon I'll see if qwen3.6-35b-a3b also have such problems (but as it spills into RAM it's 5x slower, so I tried 9b first)

What did you expect to happen?

I expect that session won't crash, even if it means stripping broken assistant reply

Client information

Qwen Code: 0.14.5 (a661294)
Runtime: Node.js v20.20.1 / npm 10.8.2
OS: linux x64 (4.4.0-26100-Microsoft)
Auth: API Key - openai
Base URL: http://localhost:11435/v1
Model: qwen3.5:9b
Fast Model: qwen3.5:9b
Session ID: 735077a1-6895-47f0-a2eb-3586cf7ca594
Sandbox: no sandbox
Proxy: no proxy
Memory Usage: 281.6 MB

Login information

"security":{"auth":{"selectedType":"openai"}}

Anything else we need to know?

No response

Metadata

Metadata

Assignees

Labels

status/needs-triageIssue needs to be triaged and labeledtype/bugSomething isn't working as expected

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions