BerriAI/litellm · error · ReplicateError

Error: {replicate_error}

Error message

Error: {replicate_error}

What it means

Error propagation in the Replicate streaming poller: the prediction failed and the response carries an 'error' field, whose value (replicate_error) is surfaced verbatim in a ReplicateError so the caller sees Replicate's failure reason.

Source

Thrown at litellm/llms/replicate/chat/handler.py:56

            response_data = response.json()
            status = response_data["status"]
            if "output" in response_data:
                try:
                    output_string = "".join(response_data["output"])
                except Exception:
                    raise ReplicateError(
                        status_code=422,
                        message="Unable to parse response. Got={}".format(response_data["output"]),
                        headers=response.headers,
                    )
                new_output = output_string[len(previous_output) :]
                print_verbose(f"New chunk: {new_output}")
                yield {"output": new_output, "status": status}
                previous_output = output_string
            status = response_data["status"]
            if status == "failed":
                replicate_error = response_data.get("error", "")
                raise ReplicateError(
                    status_code=400,
                    message=f"Error: {replicate_error}",
                    headers=response.headers,
                )
        else:
            # this can fail temporarily but it does not mean the replicate request failed, replicate request fails when status=="failed"
            print_verbose(
                f"Replicate: Failed to fetch prediction status and output.{response.status_code}{response.text}"
            )


# Function to handle prediction response (streaming)
async def async_handle_prediction_response_streaming(
    prediction_url,
    api_token,
    print_verbose,
    headers: dict,
    http_client: AsyncHTTPHandler,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Inspect the replicate_error value; the prediction failed on Replicate's side.
  2. Check the model version, input schema, and your Replicate account status/quota.

Example fix

# run the same input directly against the Replicate API to reproduce.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Triggered when the Replicate API returns an error payload for a chat prediction.

Common situations: See trigger scenarios.


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