Unexpected item type in content. - CC Switch
Quick fix
Enable content block filtering in config to remove Anthropic internal types unsupported by third-party backends.
Symptom
Section titled “Symptom”The provided messages input is invalid. The error info is [Unexpected item type in content.]When using CC Switch to proxy requests to non-official Anthropic-compatible endpoints (e.g., Alibaba Cloud Bailian), Claude Code injects proprietary Content Blocks generated by its built-in tools (e.g., server_tool_use, web_search_result) into the session history. These internal types are only recognized by the official Anthropic service; third-party backends cannot parse them and return a 400 error on subsequent requests. This issue remains open with no official merged fix; the community suggests adding filtering logic via the Rectifier layer to strip unsupported types.
Open the cc-switch configuration file and enable content block filtering in the rectifier configuration.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Can the current session continue after the error?
- No. Once unsupported internal Content Blocks are mixed into the session history, all subsequent requests for that Session will consistently return 400. You must create a new Session to restore normal conversation.
- Does this error affect specific models?
- It does not depend on the model name but on whether the target API endpoint fully complies with the standard Anthropic format. Any third-party backend rejecting non-standard types like server_tool_use or web_search_result will trigger this error.
- Why did this problem suddenly appear after enabling a local proxy or switching Provider?
- Because CC Switch forwards the complete message history by default. When Claude Code triggers built-in search or tool calls, it automatically attaches these proprietary markers. If the target endpoint is not an official Anthropic service, it intercepts the request due to unrecognized types.
Related problems
Section titled “Related problems”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.