Skip to content

Bug: Provider API z-ai/glm-5.3-flash returns 400 Invalid input (messages.12.content) #795

Closed

Description

@zhao33079-zhao

Summary

Calling Command Code GOAT Provider API with z-ai/glm-5.3-flash fails immediately with HTTP 400 after a Codex client sends image-bearing tool outputs.

This is not a timeout and not quota exhaustion. The request is translated from Codex /v1/responses to Command Code /v1/chat/completions, then rejected.

Expected Behavior

Either:

the image tool outputs are accepted and the model continues, or

the API returns a clear, documented error that image parts are not allowed in tool/function output.

Actual Behavior

Upstream returns HTTP 400 immediately:

{
"error": {
"type": "invalid_request_error",
"message": "Invalid input",
"param": "messages.12.content"
}
}

The failing history includes a function_call_output whose output is an image array, not a string:

[
{
"type": "input_image",
"image_url": "data:image/png;base64,...",
"detail": "high"
}
]

Steps to reproduce the issue

Use Codex Desktop against Command Code Provider API via an OpenAI-compatible proxy.

Select z-ai/glm-5.3-flash (client alias glm-5.3-flash-goat).

Ask Codex to inspect 3 local PNG files with view_image in parallel.

Continue the same turn / send the next model request that includes those tool outputs in history.

Command Code Version

0.0.1

Operating System

Windows

Terminal/IDE

codex

Shell

No response

Session file (optional)

No response

Fix prompt (optional)

No response

Additional context

Does z-ai/glm-5.3-flash accept image arrays inside tool/function outputs?

If not, what is the supported image format for Provider API when the client is Codex-style /v1/responses?

Is this a GLM upstream limit, or a /v1/responses → /v1/chat/completions conversion/schema issue in the gateway?

If tool output must be a plain string in Chat Completions, should the documented guidance be: convert input_image tool results to text such as [3 images viewed], or move images into a user message image_url part?

Activity

  1. self-assigned this
    on Sep 7, 2026
  2. Jovan1666 commented on Sep 13, 2026

    @Jovan1666

    Confirming the root cause with a minimal reproduction — and it is not a GLM upstream limit.

    The rule: on /provider/v1/chat/completions, a message with role: "tool" must have content that is a string, or an array of {type:"text"} parts. Anything else returns exactly this error.

    Verified by direct API calls against deepseek/deepseek-v4.1-flash, z-ai/glm-5.3-flash and deepseek/deepseek-v4-flash-vision-exp:

    content shape result
    "text" / "" 200
    [{type:"text", ...}] in any role 200
    [{type:"image_url", ...}] in a user message 200
    [{type:"image_url", ...}] in a tool message 400 messages.N.content
    [{type:"input_text", ...}] in any role 400 messages.N.content
    [{type:"output_text", ...}] in an assistant message 400 messages.N.content
    [] on a user message 400 — "Too small: expected array to have >=1 items"

    Images are accepted in user messages on every model I tried, so this is a content-schema rule on the gateway, not a model capability limit.

    Answering the questions in the report: the supported pattern is your second option — move image parts out of the tool result and into a following user message. That is also the shape Command Code's own CLI sends.

    Why Codex-style clients keep hitting this: Codex emits function_call_output.output as a content-part array, and Responses API part names (input_text / output_text) leak into the Chat translation. Both are rejected. Every Responses→Chat shim has to rewrite or relocate them, and most do not.

    Accepting — or silently dropping — non-text parts inside role:"tool" would clear this whole class of interop bugs immediately, without waiting for the Responses endpoint (#804 / #832).

  3. ahmadbilaldev commented on Sep 16, 2026

    @ahmadbilaldev
    Contributor

    should be fixed now folks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions