{"record":{"id":"407008140f73705c","repo":"BerriAI/litellm","slug":"invalid-content-type-type-content","errorCode":null,"errorMessage":"Invalid content type: {type(content)}","messagePattern":"Invalid content type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/responses/litellm_completion_transformation/transformation.py","lineNumber":1351,"sourceCode":"                                OpenAIChatCompletionTextObject(type=\"text\", text=str(encrypted_content))\n                            )\n                    else:\n                        # Skip text blocks with None text to avoid downstream errors\n                        text_value = item.get(\"text\")\n                        if text_value is None:\n                            continue\n                        content_block: dict[str, object] = {\n                            \"type\": LiteLLMCompletionResponsesConfig._get_chat_completion_request_content_type(\n                                item.get(\"type\") or \"text\"\n                            ),\n                            \"text\": text_value,\n                        }\n                        if \"cache_control\" in item:\n                            content_block[\"cache_control\"] = item[\"cache_control\"]\n                        content_list.append(content_block)\n            return content_list\n        else:\n            raise ValueError(f\"Invalid content type: {type(content)}\")\n\n    @staticmethod\n    def _get_chat_completion_request_content_type(\n        content_type: str,\n    ) -> ValidChatCompletionMessageContentTypesLiteral:\n        \"\"\"\n        Transform Responses API content type to valid Chat Completion content type.\n\n        Returns one of ValidChatCompletionMessageContentTypes:\n        - User: \"text\", \"image_url\", \"input_audio\", \"audio_url\", \"document\",\n                \"guarded_text\", \"video_url\", \"file\"\n        - Assistant: \"text\", \"thinking\", \"redacted_thinking\"\n        \"\"\"\n        # Responses API content has `input_` prefix, if it exists, remove it\n        if content_type.startswith(\"input_\"):\n            stripped: Final = content_type[len(\"input_\") :]\n            # Validate stripped type is valid, otherwise default to \"text\"\n            if stripped in ValidChatCompletionMessageContentTypes:","sourceCodeStart":1333,"sourceCodeEnd":1369,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/responses/litellm_completion_transformation/transformation.py#L1333-L1369","documentation":"Raised while converting Responses API input items to chat-completion content when a content block has an unrecognized type; the request content object shape is not one of the supported text/input_text/output_text/image variants.","triggerScenarios":"Thrown at litellm/responses/litellm_completion_transformation/transformation.py:1351 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass content as a string or a supported content-parts list."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}