jdx/mise · error

unsupported tool purgatory state version

Error message

unsupported tool purgatory state version {} in {}

What it means

`load_state` in src/tool_purgatory.rs refuses to load a purgatory state file whose `schema_version` doesn't equal the compiled-in `STATE_SCHEMA_VERSION`. The purgatory file tracks tools scheduled for removal; loading an unknown-schema file could misinterpret its fields, so mise fails fast instead of silently applying wrong removals.

Solutions

  1. Let the current mise version drain/complete pending removals (or delete the purgatory state file at the path shown in the error) so it gets recreated fresh.
  2. Re-run with the mise version that wrote the state file to let it finish its scheduled removals.
  3. Check the state file's schema_version field and compare against your mise version's changelog.
  4. Report if this happens right after an upgrade — it may indicate a missing migration.

Example fix

// before (stale state file with schema_version: 1 while binary expects 2)
rm ~/.local/share/mise/tool_purgatory.json
// after
mise reshim  # state file recreated with current schema
Defensive patterns

Strategy: fallback

Validate before calling

if let Ok(raw) = std::fs::read_to_string(state_path) { if let Ok(s) = serde_json::from_str::<serde_json::Value>(&raw) { if s.get("schema_version") != Some(&serde_json::json!(EXPECTED)) { std::fs::remove_file(&state_path).ok(); } } }

Try / catch

match load_state(path) { Err(e) if e.to_string().contains("unsupported tool purgatory state version") => { let _ = std::fs::remove_file(path); PurgatoryState::empty() }, other => other? }

Prevention

When it happens

Trigger: Reading the purgatory state JSON (via scheduled_removals, schedule, forget_path, or auto_prune) where `state.schema_version != STATE_SCHEMA_VERSION` — typically a state file written by a newer or older mise version.

Common situations: Upgrading or downgrading mise while a tool removal is pending; manually editing the state file; a stale state left over after an install layout change.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/68d8d75f3a5493cc. Report an issue: GitHub.

Appendix: source

Thrown at src/tool_purgatory.rs:61

    Ok(SystemTime::now()
        .duration_since(UNIX_EPOCH)
        .wrap_err("system clock is before the Unix epoch")?
        .as_secs())
}

fn entry_key(path: &Path) -> String {
    crate::hash::hash_sha256_to_str(&path.to_string_lossy())
}

fn load_state() -> Result<PurgatoryState> {
    let path = state_path();
    if !path.exists() {
        return Ok(PurgatoryState::empty());
    }
    let state: PurgatoryState = serde_json::from_str(&crate::file::read_to_string(path)?)
        .wrap_err_with(|| format!("failed to read tool purgatory state {}", display_path(path)))?;
    if state.schema_version != STATE_SCHEMA_VERSION {
        bail!(
            "unsupported tool purgatory state version {} in {}",
            state.schema_version,
            display_path(path)
        );
    }
    Ok(state)
}

fn save_state(state: &PurgatoryState) -> Result<()> {
    let path = state_path();
    if state.entries.is_empty() {
        match std::fs::remove_file(path) {
            Ok(()) => {}
            Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}
            Err(err) => return Err(err.into()),
        }
        return Ok(());
    }

View on GitHub (pinned to 533346cc37)