I tried setting up glm-5.2 as a model via the openrouter provider but was unable to get it to work.
Steps to reproduce
- Launch coder with
CODER_AI_GATEWAY_DUMP_DIR=/tmp/aibridge-dumps
- Configure an OpenRouter provider
- Configure
z-ai/glm-5.2 as a model with the OpenRouter provider
- Enable experimental chat debug logging for deployment
- Enable experimental chat debug logging for user
- Attempt to send a message via Coder Agents
- Observe a somewhat useless error message from Coder Agents
- Click into "Debug" tab
- Click into one of the failed steps
- Observe error
bad gateway: unknown stream error: unexpected end of JSON input
- Also observe the dump from AI Gateway
(some fields removed for brevity)
HTTP/2.0 200 OK
Content-Type: text/event-stream
: OPENROUTER PROCESSING
Possible Root cause
Based on the AI Gateway dump, we can assume the follow steps occur:
Impact
Any provider that emits SSE comment-only events (comment lines followed by blank lines with no data: field) will trigger this bug.
I tried setting up glm-5.2 as a model via the openrouter provider but was unable to get it to work.
Steps to reproduce
CODER_AI_GATEWAY_DUMP_DIR=/tmp/aibridge-dumpsz-ai/glm-5.2as a model with the OpenRouter providerbad gateway: unknown stream error: unexpected end of JSON input(some fields removed for brevity)
Possible Root cause
Based on the AI Gateway dump, we can assume the follow steps occur:
: OPENROUTER PROCESSINGStream.Next()then attempts to unmarshal the empty bytesImpact
Any provider that emits SSE comment-only events (comment lines followed by blank lines with no
data:field) will trigger this bug.