{"record":{"id":"4a3be9675a5e837b","repo":"BerriAI/litellm","slug":"error-message-4a3be9","errorCode":null,"errorMessage":"{error_message}","messagePattern":"\\{error_message\\}","errorType":"http","errorClass":"BaseLLMException","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/responses/transformation.py","lineNumber":229,"sourceCode":"    ) -> tuple[str, dict]:\n        pass\n\n    @abstractmethod\n    def transform_list_input_items_response(\n        self,\n        raw_response: httpx.Response,\n        logging_obj: LiteLLMLoggingObj,\n    ) -> dict:\n        pass\n\n    #########################################################\n    ########## END GET RESPONSE API TRANSFORMATION ##########\n    #########################################################\n\n    def get_error_class(self, error_message: str, status_code: int, headers: dict | httpx.Headers) -> BaseLLMException:\n        from ..chat.transformation import BaseLLMException\n\n        raise BaseLLMException(\n            status_code=status_code,\n            message=error_message,\n            headers=headers,\n        )\n\n    def should_fake_stream(\n        self,\n        model: str | None,\n        stream: bool | None,\n        custom_llm_provider: str | None = None,\n    ) -> bool:\n        \"\"\"Returns True if litellm should fake a stream for the given model and stream value\"\"\"\n        return False\n\n    def supports_native_websocket(self) -> bool:\n        \"\"\"\n        Returns True if the provider has a native WebSocket endpoint for Responses API.\n","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/responses/transformation.py#L211-L247","documentation":"This is the generic error path of the BaseResponsesAPIConfig for LiteLLM's Responses API. When a provider returns a non-2xx HTTP response during a /v1/responses call, LiteLLM builds a BaseLLMException from the provider's error message, HTTP status code, and response headers. The '{error_message}' placeholder in the traceback is the upstream provider's own error text (e.g. an OpenAI-style 'invalid_request_error' body). It usually surfaces to callers as a litellm exception mapped from the status code (400/401/429/500 etc.).","triggerScenarios":"Calling litellm.responses() (or a provider's Responses API transformation) where the upstream request fails: invalid model name, expired/incorrect API key (401), rate limit (429), malformed input_params, or a provider outage (5xx). The transformation layer catches the failed HTTP response and invokes get_error_class(), which raises BaseLLMException with the provider's message verbatim.","commonSituations":"Typos in the model name; missing or wrong OPENAI_API_KEY/generic API key env var; hitting org rate limits; sending Responses-API-specific params the provider rejects; proxy misrouting to a wrong endpoint; provider version changes deprecating a parameter.","solutions":["Read the full provider message and status_code carried in the exception (and the headers) — the fix is almost always upstream (auth, model name, payload), not in litellm itself.","Verify the API key for the provider is set and valid (e.g. os.environ['OPENAI_API_KEY']) and that 'model' is spelled '<provider>/<model>' correctly.","Reproduce the same request with the provider's native SDK or curl to confirm whether the error is a litellm mapping issue or a genuine provider rejection.","For 429s add retry_with_fallback or configure num_retries/cooling_time; for 401/403 rotate credentials.","If the error body is truncated or unhelpful, enable litellm.debug_logger or set LITELLM_LOG=DEBUG to inspect the raw response."],"exampleFix":"# before\nresp = litellm.responses(model=\"openai/gpt-4o\", input=\"hi\")\n\n# after: catch and inspect status + provider message\nimport litellm\nfrom litellm.llms.base_llm.chat.transformation import BaseLLMException\n\ntry:\n    resp = litellm.responses(model=\"openai/gpt-4o\", input=\"hi\")\nexcept BaseLLMException as e:\n    print(e.status_code, e.message)  # e.g. 401 'Incorrect API key provided'","handlingStrategy":"try-catch","validationCode":"import litellm\n\n# validate model exists and key is present before calling\nassert litellm.validate_environment(model=\"openai/gpt-4o\"), \"missing credentials for provider\"","typeGuard":"from litellm.llms.base_llm.chat.transformation import BaseLLMException\n\ndef is_responses_provider_error(e: BaseException) -> bool:\n    return isinstance(e, BaseLLMException) and hasattr(e, \"status_code\")","tryCatchPattern":"try:\n    resp = litellm.responses(model=\"openai/gpt-4o\", input=\"hi\")\nexcept BaseLLMException as e:\n    if e.status_code == 429:\n        backoff_and_retry()\n    elif e.status_code in (401, 403):\n        rotate_credentials()\n    else:\n        raise","preventionTips":["Centralize provider errors: catch BaseLLMException once and branch on status_code.","Log e.message and headers on failure; they carry the provider's real diagnosis.","Use litellm Router with fallbacks so a failing provider degrades instead of surfacing the error."],"tags":["responses-api","http-error","provider-error","litellm"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}