BerriAI/litellm · error · PalmError

{traceback.format_exc()}

Error message

{traceback.format_exc()}

What it means

Error "{traceback.format_exc()}" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/deprecated_providers/palm.py:167

        api_key="",
        original_response=response,
        additional_args={"complete_input_dict": {}},
    )
    print_verbose(f"raw model_response: {response}")
    ## RESPONSE OBJECT
    completion_response = response
    try:
        choices_list: Final = []
        for idx, item in enumerate(completion_response.candidates):
            if len(item["output"]) > 0:
                message_obj = Message(content=item["output"])
            else:
                message_obj = Message(content=None)
            choice_obj = Choices(index=idx + 1, message=message_obj)
            choices_list.append(choice_obj)
        model_response.choices = choices_list
    except Exception:
        raise PalmError(message=traceback.format_exc(), status_code=response.status_code)

    try:
        completion_response = model_response["choices"][0]["message"].get("content")
    except Exception:
        raise PalmError(
            status_code=400,
            message=f"No response received. Original response - {response}",
        )

    ## CALCULATING USAGE - baseten charges on time, not tokens - have some mapping of cost here.
    prompt_tokens: Final = len(encoding.encode(prompt))
    completion_tokens: Final = len(encoding.encode(model_response["choices"][0]["message"].get("content", "")))

    model_response.created = int(time.time())
    model_response.model = "palm/" + model
    usage: Final = Usage(
        prompt_tokens=prompt_tokens,
        completion_tokens=completion_tokens,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. See the traceback for the PaLM call failure.

When it happens

Trigger: Thrown at litellm/llms/deprecated_providers/palm.py:167 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/c0aa1f65bf6ab30c. Report an issue: GitHub.