Pumpkin-MC/Pumpkin · warning · UpdateError

Failed to parse update response JSON

Error message

Failed to parse update response JSON: {0}

What it means

UpdateError::Json wraps a serde_json::Error produced when the Marketplace API response body cannot be parsed into the expected update-info struct. The library throws it after a successful HTTP call whose payload is not valid JSON or doesn't match the expected schema.

Solutions

  1. Log the raw response body to see what was actually returned and compare against the expected schema.
  2. Retry the check — transient CDN/proxy pages often resolve on retry.
  3. Update pumpkin-plugin-utils to a version matching the current Marketplace API schema.
  4. Guard the call so a parse failure only disables update notifications rather than the plugin.

Example fix

// before
let info = serde_json::from_str::<UpdateInfo>(&body).unwrap();
// after
let info = match update_checker.check() {
    Ok(i) => i,
    Err(UpdateError::Json(e)) => { log::warn!("bad update payload: {e}"); return; }
    Err(e) => { log::warn!("update check failed: {e}"); return; }
};
Defensive patterns

Strategy: fallback

Validate before calling

// quick sanity check before trusting the payload
if !body.trim_start().starts_with('{') {
    log::warn!("update API returned non-JSON body");
}

Try / catch

match update_checker.check() {
    Ok(info) => info,
    Err(UpdateError::Json(e)) => { log::warn!("unparsable update payload: {e}"); return; }
    Err(e) => { log::warn!("update check failed: {e}"); return; }
}

Prevention

When it happens

Trigger: UpdateChecker::check receives a 200 response whose body fails serde deserialization: malformed JSON, HTML error page instead of JSON, or schema drift in the Marketplace API.

Common situations: A reverse proxy or captive portal returns an HTML page; Marketplace API version changed its response shape; CDN returns an error document with 200 status.

Understand the failure class

Related errors


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

Appendix: source

Thrown at crates/pumpkin-plugin-utils/src/updater.rs:22

    http::{HttpClient, HttpError},
    models::CheckUpdateResponse,
};
use thiserror::Error;
use tracing::debug;

/// Update checking errors.
#[derive(Debug, Error)]
pub enum UpdateError {
    /// Plugin has not been initialized.
    #[error(
        "Plugin-utils has not been initialized (call pumpkin_plugin_utils::init(context) first)"
    )]
    NotInitialized,
    /// HTTP error when querying update endpoint.
    #[error("Failed to query update API: {0}")]
    Http(#[from] HttpError),
    /// JSON parsing error from response.
    #[error("Failed to parse update response JSON: {0}")]
    Json(#[from] serde_json::Error),
}

/// Checks for plugin updates against the Pumpkin Marketplace API.
pub struct UpdateChecker {
    http_client: HttpClient,
}

impl Default for UpdateChecker {
    fn default() -> Self {
        Self::new()
    }
}

impl UpdateChecker {
    /// Creates a new `UpdateChecker`.
    #[must_use]
    pub fn new() -> Self {

View on GitHub (pinned to 8d4639e25a)