Skip to content

The provided messages input is invalid - Claude Code

Quick fix

If a session keeps failing after triggering a built-in tool, start a new session; check whether the third-party backend rejects Anthropic internal content…

Error output
The provided messages input is invalid. The error info is [Unexpected item type in content.]

When Claude Code forwards session history to a third-party Anthropic-compatible backend, the backend may return 400 if the history contains unsupported Anthropic internal content types such as `server_tool_use`, `web_search_tool_result`, `web_search_result`, `tool_reference`, or `ephemeral`. Reports say that after a built-in tool is triggered, subsequent requests in the same session also fail; starting a new session can temporarily bypass the old history.

Another similar report involved image input in cc-switch 3.16.4, but it did not specify the provider, model, or API format. The maintainer said it was not possible to determine whether that error was caused by format conversion or lack of image support, so it cannot be confirmed as having the same cause as internal content types in session history.

  1. If the error occurs in a Claude Code session that has used a built-in tool, start a new session as a temporary workaround.

  2. If the new session still fails, record the cc-switch version, provider and model name, API format setting, and whether the model supports images. This information can help distinguish session history content types, format conversion, and image support issues.

  3. Retest on cc-switch 4.0 using the same steps. The maintainer noted that 4.0 rewrote the relevant configuration path, but the issue did not confirm that this problem was fixed.

ToolClaude Code
Version3.16.4;另有报告仅注明 3.x latest
PlatformsWindowsmacOS
What solution is currently available for the same problem?
The issue reports that starting a new session can temporarily resolve persistent 400 errors in an old session. The maintainer recommends retesting on 4.0 and providing details such as the version, provider and model name, and API format setting.

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.