{"record":{"id":"68d8d75f3a5493cc","repo":"jdx/mise","slug":"unsupported-tool-purgatory-state-version-in","errorCode":null,"errorMessage":"unsupported tool purgatory state version {} in {}","messagePattern":"unsupported tool purgatory state version (.+?) in (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/tool_purgatory.rs","lineNumber":61,"sourceCode":"    Ok(SystemTime::now()\n        .duration_since(UNIX_EPOCH)\n        .wrap_err(\"system clock is before the Unix epoch\")?\n        .as_secs())\n}\n\nfn entry_key(path: &Path) -> String {\n    crate::hash::hash_sha256_to_str(&path.to_string_lossy())\n}\n\nfn load_state() -> Result<PurgatoryState> {\n    let path = state_path();\n    if !path.exists() {\n        return Ok(PurgatoryState::empty());\n    }\n    let state: PurgatoryState = serde_json::from_str(&crate::file::read_to_string(path)?)\n        .wrap_err_with(|| format!(\"failed to read tool purgatory state {}\", display_path(path)))?;\n    if state.schema_version != STATE_SCHEMA_VERSION {\n        bail!(\n            \"unsupported tool purgatory state version {} in {}\",\n            state.schema_version,\n            display_path(path)\n        );\n    }\n    Ok(state)\n}\n\nfn save_state(state: &PurgatoryState) -> Result<()> {\n    let path = state_path();\n    if state.entries.is_empty() {\n        match std::fs::remove_file(path) {\n            Ok(()) => {}\n            Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}\n            Err(err) => return Err(err.into()),\n        }\n        return Ok(());\n    }","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/tool_purgatory.rs#L43-L79","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Re-run with the mise version that wrote the state file to let it finish its scheduled removals.","Check the state file's schema_version field and compare against your mise version's changelog.","Report if this happens right after an upgrade — it may indicate a missing migration."],"exampleFix":"// before (stale state file with schema_version: 1 while binary expects 2)\nrm ~/.local/share/mise/tool_purgatory.json\n// after\nmise reshim  # state file recreated with current schema","handlingStrategy":"fallback","validationCode":"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(); } } }","typeGuard":null,"tryCatchPattern":"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? }","preventionTips":["Avoid running mixed mise versions against the same install dir concurrently.","Let pending removals complete before upgrading mise.","Don't hand-edit purgatory state files."],"tags":["state","schema-version","persistence"],"backgroundTag":"schema-validation-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}