BerriAI/litellm · error · OpenAILikeError

e.response.text if e.response else str(e)

Error message

e.response.text if e.response else str(e)

What it means

Error-mapping branch for the OpenAI-like async embedding call: the POST returned an HTTP error, and the message uses the response body text when a response object exists, otherwise the exception's string form (e.g. connection refused before a response).

Source

Thrown at litellm/llms/openai_like/embedding/handler.py:57

            if client is None or not isinstance(client, AsyncHTTPHandler):
                async_client = get_async_httpx_client(
                    llm_provider=litellm.LlmProviders.OPENAI,
                    params={"timeout": timeout},
                )
            else:
                async_client = client
            try:
                response = await async_client.post(
                    api_base,
                    headers=headers,
                    data=json.dumps(data),
                )

                response.raise_for_status()

                response_json: Final = response.json()
            except httpx.HTTPStatusError as e:
                raise OpenAILikeError(
                    status_code=e.response.status_code,
                    message=e.response.text if e.response else str(e),
                )
            except httpx.TimeoutException:
                raise OpenAILikeError(status_code=408, message="Timeout error occurred.")
            except Exception as e:
                raise OpenAILikeError(status_code=500, message=str(e))

            ## LOGGING
            logging_obj.post_call(
                input=input,
                api_key=api_key,
                additional_args={"complete_input_dict": data},
                original_response=response_json,
            )
            return EmbeddingResponse(**response_json)
        except Exception as e:
            ## LOGGING

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Inspect the HTTP error body in the message; fix credentials or embedding request payload.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/llms/openai_like/embedding/handler.py:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/651b4d7029344081. Report an issue: GitHub.