{"record":{"id":"e464cf00423438a5","repo":"Pumpkin-MC/Pumpkin","slug":"http-request-failed-0","errorCode":null,"errorMessage":"HTTP request failed: {0}","messagePattern":"HTTP request failed: (.+?)","errorType":"exception","errorClass":"HttpError","httpStatus":null,"severity":"error","filePath":"crates/pumpkin-plugin-utils/src/http.rs","lineNumber":9,"sourceCode":"//! HTTP client helpers for online license checks and marketplace queries.\n\nuse thiserror::Error;\n\n/// HTTP request errors.\n#[derive(Debug, Error)]\npub enum HttpError {\n    /// Network or connection error.\n    #[error(\"HTTP request failed: {0}\")]\n    RequestFailed(String),\n    /// Response status code was not successful (2xx).\n    #[error(\"HTTP response returned error status {0}: {1}\")]\n    BadStatus(u16, String),\n    /// Error reading response body.\n    #[error(\"Failed to read HTTP response body: {0}\")]\n    BodyRead(String),\n}\n\n/// Helper client for querying Pumpkin marketplace REST APIs.\npub struct HttpClient {\n    client: reqwest::blocking::Client,\n}\n\nimpl Default for HttpClient {\n    fn default() -> Self {\n        Self::new(\"Pumpkin-Plugin-Utils/0.1.0\")\n    }","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/Pumpkin-MC/Pumpkin/blob/8d4639e25a57c15e47448ec327c780d41bbf2356/crates/pumpkin-plugin-utils/src/http.rs#L1-L27","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the wrapped `{0}` message to identify whether it's DNS, connect, or TLS, and fix that specific cause.","Verify the configured URL (scheme, host, port) and test connectivity from the host (`curl -v <url>`).","Add retry with backoff for transient network failures.","Handle the error via `HttpError::RequestFailed` matching so the plugin degrades gracefully instead of unwrapping."],"exampleFix":"// before\nlet body = http::get(&url).unwrap(); // panics on network failure\n// after\nmatch http::get(&url) {\n    Ok(body) => {},\n    Err(HttpError::RequestFailed(msg)) => log::warn!(\"network issue: {msg}\"),\n    Err(e) => log::error!(\"http error: {e}\"),\n}","handlingStrategy":"try-catch","validationCode":"// Pre-flight the URL and connectivity:\nlet url = url::Url::parse(&cfg.endpoint)?; // fail fast on malformed URL","typeGuard":"fn is_network_failure(e: &HttpError) -> bool { matches!(e, HttpError::RequestFailed(_)) }","tryCatchPattern":"match http::get(&url) {\n    Ok(body) => process(body),\n    Err(HttpError::RequestFailed(msg)) => log::warn!(\"network: {msg}\"),\n    Err(e) => log::error!(\"{e}\"),\n}","preventionTips":["Retry transient failures with exponential backoff.","Validate endpoint URLs in plugin config at startup.","Check host DNS/firewall before deploying plugins that call remote APIs.","Never unwrap HTTP results in plugin code."],"tags":["http","network","plugin-utils","connection"],"backgroundTag":"http-request-failed","analyzedSha":"8d4639e25a57c15e47448ec327c780d41bbf2356","analyzedAt":"2026-09-09T15:32:22.916Z","contentChangedAt":"2026-09-09T15:32:22.916Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}