Skip to content

Invalid messages.content.type Parameter Claude Code

Quick fix

Most related issues remain unresolved. Upgrade to a version containing the #7656 fix so Chinese image-rejection errors trigger image fallback retries.

Error output
messages.content.type 参数非法,取值范围 ['text']
English translation

Invalid messages.content.type parameter; allowed values: ['text']

When Claude Code sends a request containing an image block through cc-switch's `openai_chat` conversion path, a text-only upstream returns a Chinese 400 error. Image-rejection keyword matching in v3.20.1 primarily uses English patterns and does not match this Chinese error, so it is passed through unchanged. Once an image enters the conversation history, later requests continue to fail.

  1. Upgrade cc-switch to a version containing the #7656 fix. The fix adds Chinese patterns for image-rejection error matching; when a request contains an image block, it replaces the image with placeholder text and retries.

  2. For a session that continues to return the same 400, send the request again after upgrading so fallback retries can process image blocks in the history.

ToolClaude Code
Version3.20.1(受影响报告版本)
PlatformsmacOS

(No FAQ yet)

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.