{"record":{"id":"bcb755058e76c592","repo":"BerriAI/litellm","slug":"error-msg-upstream-response-error-message","errorCode":null,"errorMessage":"error_msg (upstream response error message)","messagePattern":"error_msg \\(upstream response error message\\)","errorType":"http","errorClass":"BaseLLMException","httpStatus":null,"severity":"error","filePath":"litellm/llms/custom_httpx/container_handler.py","lineNumber":283,"sourceCode":"                if is_multipart and \"file\" in kwargs:\n                    files, headers = _prepare_multipart_file_upload(kwargs[\"file\"], headers)\n                    response = http_client.post(url=url, headers=headers, params=effective_params, files=files)\n                else:\n                    response = http_client.post(url=url, headers=headers, params=effective_params)\n            else:\n                raise ValueError(f\"Unsupported HTTP method: {method}\")\n\n            # For binary responses, return raw content\n            if returns_binary:\n                return response.content\n\n            # Check for error response\n            response_json: Final = response.json()\n            if \"error\" in response_json:\n                from litellm.llms.base_llm.chat.transformation import BaseLLMException\n\n                error_msg: Final = response_json.get(\"error\", {}).get(\"message\", str(response_json))\n                raise BaseLLMException(\n                    status_code=response.status_code,\n                    message=error_msg,\n                    headers=dict(response.headers),\n                )\n\n            # Parse response\n            response_type: Final = RESPONSE_TYPES.get(endpoint_config[\"response_type\"])\n            if response_type:\n                return response_type(**response_json)\n            return response_json\n\n        except Exception as e:\n            raise e\n\n    async def _async_handle(\n        self,\n        endpoint_name: str,\n        container_provider_config: \"BaseContainerConfig\",","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/custom_httpx/container_handler.py#L265-L301","documentation":"Raised by litellm's container handler (sync path) when a container-provider HTTP endpoint returns a JSON body containing an 'error' key. LiteLLM wraps the upstream error message and status code in a BaseLLMException so callers see a uniform exception type. It mirrors whatever failure the upstream container service (e.g. a self-hosted model server) reported.","triggerScenarios":"Calling a container-based provider endpoint (e.g. Pinecone/container REST route) where the upstream returns JSON like {\"error\": {\"message\": \"...\"}} — bad request payloads, invalid IDs, upstream 4xx/5xx with JSON error bodies, or expired/invalid credentials on the container service.","commonSituations":"Misconfigured api_base pointing at a container service that rejects the request; deleting or fetching a resource (file, index, job) that does not exist; upstream container service rate limiting or internal errors returned as JSON.","solutions":["Inspect the exception's message field — it is the upstream service's own error message and names the real cause","Check exception.status_code and headers to see if it is auth (401/403), not-found (404), or rate-limit (429) related","Verify the endpoint config in the container provider config: correct api_base, path, and request params for the endpoint you call","If 401/403, fix the credentials/token passed to the container provider","If 429/5xx, retry with backoff or check container service health"],"exampleFix":"# before\nresp = container_handler.sync_request(endpoint_name=\"files\", ...)\n\n# after\nfrom litellm.llms.base_llm.chat.transformation import BaseLLMException\ntry:\n    resp = container_handler.sync_request(endpoint_name=\"files\", ...)\nexcept BaseLLMException as e:\n    print(e.status_code, e.message)  # upstream's real error\n    raise","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.llms.base_llm.chat.transformation import BaseLLMException\ntry:\n    resp = container_handler.sync_request(endpoint_name=name, ...)\nexcept BaseLLMException as e:\n    if e.status_code in (429, 500, 502, 503):\n        raise TransientError(e.message) from e\n    raise","preventionTips":["Validate IDs and params before container endpoint calls","Log BaseLLMException.status_code and headers alongside the message for faster triage"],"tags":["http","upstream-error","container-handler","litellm"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}