Pumpkin-MC/Pumpkin · error · HttpError

HTTP request failed

Error message

HTTP request failed: {0}

What it means

`HttpError::RequestFailed` is a variant of the thiserror-based `HttpError` enum in pumpkin-plugin-utils. It wraps the underlying network/transport error message and displays as "HTTP request failed: {0}". It means the HTTP request never completed successfully at the transport level — connection failure, DNS resolution, TLS handshake, or I/O error — not that the server returned an error status.

Solutions

  1. Read the wrapped `{0}` message to identify whether it's DNS, connect, or TLS, and fix that specific cause.
  2. Verify the configured URL (scheme, host, port) and test connectivity from the host (`curl -v <url>`).
  3. Add retry with backoff for transient network failures.
  4. Handle the error via `HttpError::RequestFailed` matching so the plugin degrades gracefully instead of unwrapping.

Example fix

// before
let body = http::get(&url).unwrap(); // panics on network failure
// after
match http::get(&url) {
    Ok(body) => {},
    Err(HttpError::RequestFailed(msg)) => log::warn!("network issue: {msg}"),
    Err(e) => log::error!("http error: {e}"),
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight the URL and connectivity:
let url = url::Url::parse(&cfg.endpoint)?; // fail fast on malformed URL

Type guard

fn is_network_failure(e: &HttpError) -> bool { matches!(e, HttpError::RequestFailed(_)) }

Try / catch

match http::get(&url) {
    Ok(body) => process(body),
    Err(HttpError::RequestFailed(msg)) => log::warn!("network: {msg}"),
    Err(e) => log::error!("{e}"),
}

Prevention

When it happens

Trigger: Calling the plugin HTTP utilities (e.g. `http::get`/`request`-style helpers) when the target host is unreachable, DNS fails, the TLS handshake fails, or the connection is reset/timed out at the transport layer.

Common situations: Server machine has no outbound internet or DNS; firewall blocks the port; wrong URL scheme/host in plugin config; TLS certificate issues; the remote API is down.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

//! 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")
    }

View on GitHub (pinned to 8d4639e25a)