BerriAI/litellm · error · CoreError

upstream request failed with status {status}: {body}

Error message

upstream request failed with status {status}: {body}

What it means

Error "upstream request failed with status {status}: {body}" thrown in BerriAI/litellm.

Source

Thrown at litellm-rust/crates/core/src/error.rs:22

#[derive(Debug, Error, PartialEq, Eq)]
pub enum CoreError {
    #[error("expected {expected}, got {actual}")]
    InvalidType {
        expected: &'static str,
        actual: &'static str,
    },
    #[error("missing required field: {0}")]
    MissingField(&'static str),
    #[error("invalid response: {0}")]
    InvalidResponse(String),
    #[error("invalid provider: {0}")]
    InvalidProvider(String),
    #[error("invalid request: {0}")]
    InvalidRequest(String),
    #[error("{0}")]
    Auth(String),
    #[error("upstream request failed with status {status}: {body}")]
    Http { status: u16, body: String },
    #[error("upstream network error: {0}")]
    Network(String),
    #[error("routing error: {0}")]
    Routing(String),
}

pub fn json_type_name(value: &serde_json::Value) -> &'static str {
    match value {
        serde_json::Value::Null => "null",
        serde_json::Value::Bool(_) => "bool",
        serde_json::Value::Number(_) => "number",
        serde_json::Value::String(_) => "string",
        serde_json::Value::Array(_) => "array",
        serde_json::Value::Object(_) => "object",
    }
}

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Inspect the upstream status {status} and body {body}: fix auth for 401/403, payload for 400/422, or retry/back off for 429/5xx.

When it happens

Trigger: Thrown at litellm-rust/crates/core/src/error.rs:22 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/c42eac2983e7d576. Report an issue: GitHub.