BerriAI/litellm · error · PredibaseError

str(completion_response["error"])

Error message

str(completion_response["error"])

What it means

Upstream error propagation in the Predibase transformation: the parsed JSON body contains an 'error' key, and its stringified value is raised as a PredibaseError with the HTTP status, surfacing Predibase's own error payload.

Source

Thrown at litellm/llms/predibase/chat/transformation.py:152

        optional_params: dict,
        litellm_params: dict,
        encoding: Any,
        api_key: str | None = None,
        json_mode: bool | None = None,
    ) -> ModelResponse:
        logging_obj.post_call(
            input=messages,
            api_key=api_key or "",
            original_response=raw_response.text,
            additional_args={"complete_input_dict": request_data},
        )
        try:
            completion_response: Final = raw_response.json()
        except Exception:
            raise PredibaseError(message=raw_response.text, status_code=422)

        if "error" in completion_response:
            raise PredibaseError(
                message=str(completion_response["error"]),
                status_code=raw_response.status_code,
            )
        elif not isinstance(completion_response, dict):
            raise PredibaseError(
                status_code=422,
                message=f"'completion_response' is not a dictionary - {completion_response}",
            )
        elif "generated_text" not in completion_response:
            raise PredibaseError(
                status_code=422,
                message=f"'generated_text' is not a key response dictionary - {completion_response}",
            )

        if len(completion_response["generated_text"]) > 0:
            model_response.choices[0].message.content = self.output_parser(completion_response["generated_text"])

        if "details" in completion_response and "tokens" in completion_response["details"]:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. The Predibase completion returned an 'error' field; inspect completion_response["error"] for details.
  2. Check that the model/deployment name and prompt are valid for your Predibase tenant.

Example fix

# adjust request based on the error string returned in the completion response.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Triggered when the Predibase completion response dictionary contains an 'error' key.

Common situations: See trigger scenarios.


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