{"record":{"id":"ce4ec85a59a3811a","repo":"BerriAI/litellm","slug":"error-status-error-message","errorCode":null,"errorMessage":"{error_status} - {error_message}","messagePattern":"\\{error_status\\} - \\{error_message\\}","errorType":"http","errorClass":"VertexAIError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py","lineNumber":3118,"sourceCode":"        \"\"\"Detect embedded errors (e.g. 429 RESOURCE_EXHAUSTED) in streaming chunks and raise VertexAIError.\"\"\"\n        if \"error\" not in chunk:\n            return\n        error_data: Final = chunk[\"error\"]\n        if not isinstance(error_data, dict):\n            raise VertexAIError(\n                status_code=500,\n                message=f\"Unexpected error format in mid-stream chunk: {error_data}\",\n            )\n        raw_code = error_data.get(\"code\", 500)\n        if raw_code is None:\n            raw_code = 500\n        try:\n            error_code = int(raw_code)\n        except (TypeError, ValueError):\n            error_code = 500\n        error_message: Final = error_data.get(\"message\", \"Unknown error\")\n        error_status: Final = error_data.get(\"status\", \"UNKNOWN\")\n        raise VertexAIError(\n            status_code=error_code,\n            message=f\"{error_status} - {error_message}\",\n        )\n\n    def _apply_stream_candidates(\n        self,\n        _candidates: list[Candidates],\n        model_response: \"ModelResponseStream\",\n    ) -> tuple[list[dict], list[dict], list[dict], list[dict]]:\n        (\n            grounding_metadata,\n            url_context_metadata,\n            safety_ratings,\n            citation_metadata,\n            self.cumulative_tool_call_index,\n        ) = VertexGeminiConfig._process_candidates(\n            _candidates,\n            model_response,","sourceCodeStart":3100,"sourceCodeEnd":3136,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py#L3100-L3136","documentation":"Gemini streaming error detector: the chunk embeds a structured provider error (e.g. 429 RESOURCE_EXHAUSTED) rather than a valid candidate; it is re-raised as VertexAIError with the provider's status code and message.","triggerScenarios":"Triggered when a streaming chunk from Vertex AI Gemini carries an error status and message.","commonSituations":"See trigger scenarios.","solutions":["Read error_status and error_message for the specific failure.","Fix per the returned status (auth, quota, invalid request)."],"exampleFix":"# handle based on the error_status shown in the exception.","handlingStrategy":"try-catch","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-14T05:17:10.506Z"}