Pumpkin-MC/Pumpkin · error · HttpError

HTTP response returned error status

Error message

HTTP response returned error status {0}: {1}

What it means

`HttpError::BadStatus` is returned when an HTTP response completed but its status code was not successful (not 2xx); it displays as "HTTP response returned error status {0}: {1}" carrying the numeric status and the response/status text. It lets plugin code distinguish server-side rejections (404, 401, 500, rate limits) from transport failures (`RequestFailed`).

Solutions

  1. Inspect the status code and message: handle 401/403 by fixing credentials, 404 by correcting the URL, 429 by backing off.
  2. Add retry-with-backoff only for 5xx/429; do not retry 4xx client errors.
  3. Validate configured endpoints and auth material before requests.
  4. Match on `HttpError::BadStatus(status, msg)` to branch on the status code programmatically.

Example fix

// before
let data = http::get(&url).unwrap();
// after
match http::get(&url) {
    Ok(data) => {},
    Err(HttpError::BadStatus(429, _)) => schedule_retry(),
    Err(HttpError::BadStatus(code, msg)) => log::error!("API rejected: {code} {msg}"),
    Err(e) => log::error!("{e}"),
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate auth and endpoint before calling:
assert!(!api_key.is_empty(), "missing API key for remote endpoint");

Type guard

fn is_bad_status(e: &HttpError) -> Option<(u16, &str)> {
    match e { HttpError::BadStatus(c, m) => Some((*c, m.as_str())), _ => None }
}

Try / catch

match http::get(&url) {
    Ok(data) => process(data),
    Err(HttpError::BadStatus(code, msg)) if code == 429 || code >= 500 => retry_with_backoff(),
    Err(HttpError::BadStatus(code, msg)) => log::error!("request rejected: {code} {msg}"),
    Err(e) => log::error!("{e}"),
}

Prevention

When it happens

Trigger: Any HTTP utility call in pumpkin-plugin-utils that receives a response with a non-2xx status — e.g. requesting a deleted resource (404), expired/missing credentials (401/403), server errors (5xx), or hitting a rate limit (429).

Common situations: Outdated API endpoints in plugin config; missing or expired API keys; calling an API too frequently and getting 429; upstream service outage returning 5xx; typo in the URL path.

Related errors


AI-assisted analysis of Pumpkin-MC/Pumpkin@8d4639e25a (2026-09-09). Data as JSON: /api/errors/40963bb80ce554ab. Report an issue: GitHub.

Appendix: source

Thrown at crates/pumpkin-plugin-utils/src/http.rs:12

//! HTTP client helpers for online license checks and marketplace queries.

use thiserror::Error;

/// HTTP request errors.
#[derive(Debug, Error)]
pub enum HttpError {
    /// Network or connection error.
    #[error("HTTP request failed: {0}")]
    RequestFailed(String),
    /// Response status code was not successful (2xx).
    #[error("HTTP response returned error status {0}: {1}")]
    BadStatus(u16, String),
    /// Error reading response body.
    #[error("Failed to read HTTP response body: {0}")]
    BodyRead(String),
}

/// Helper client for querying Pumpkin marketplace REST APIs.
pub struct HttpClient {
    client: reqwest::blocking::Client,
}

impl Default for HttpClient {
    fn default() -> Self {
        Self::new("Pumpkin-Plugin-Utils/0.1.0")
    }
}

impl HttpClient {

View on GitHub (pinned to 8d4639e25a)