{"record":{"id":"281ada5c60b552bd","repo":"BerriAI/litellm","slug":"cometapi-error","errorCode":null,"errorMessage":"CometAPI Error: {}","messagePattern":"CometAPI Error: (.+?)","errorType":"exception","errorClass":"CometAPIException","httpStatus":null,"severity":"error","filePath":"litellm/llms/cometapi/chat/transformation.py","lineNumber":166,"sourceCode":"            json_mode=json_mode,\n        )\n\n\nclass CometAPIChatCompletionStreamingHandler(BaseModelResponseIterator):\n    \"\"\"\n    Handler for CometAPI streaming chat completion responses\n    \"\"\"\n\n    def chunk_parser(self, chunk: dict) -> ModelResponseStream:\n        \"\"\"\n        Parse individual chunks from streaming response\n        \"\"\"\n        try:\n            # Handle error in chunk\n            if \"error\" in chunk:\n                error_chunk: Final = chunk[\"error\"]\n                error_message: Final = \"CometAPI Error: {}\".format(error_chunk.get(\"message\", \"Unknown error\"))\n                raise CometAPIException(\n                    message=error_message,\n                    status_code=error_chunk.get(\"code\", 400),\n                    headers={\"Content-Type\": \"application/json\"},\n                )\n\n            # Process choices\n            new_choices: Final = []\n            for choice in chunk[\"choices\"]:\n                # Handle reasoning content if present\n                if \"delta\" in choice and \"reasoning\" in choice[\"delta\"]:\n                    choice[\"delta\"][\"reasoning_content\"] = choice[\"delta\"].get(\"reasoning\")\n                new_choices.append(choice)\n\n            return ModelResponseStream(\n                id=chunk[\"id\"],\n                object=\"chat.completion.chunk\",\n                created=chunk[\"created\"],\n                usage=chunk.get(\"usage\"),","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/cometapi/chat/transformation.py#L148-L184","documentation":"Error \"CometAPI Error: {}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/cometapi/chat/transformation.py:166 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the CometAPI error message for details."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}