{"record":{"id":"eee59500e24a0cd0","repo":"jdx/mise","slug":"unsupported-package-plugin-ownership-state-version","errorCode":null,"errorMessage":"unsupported package plugin ownership state version {} in {}","messagePattern":"unsupported package plugin ownership state version (.+?) in (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/plugin.rs","lineNumber":146,"sourceCode":"    }\n\n    fn load_state_at(path: &std::path::Path, manager: &str) -> Result<PackagePluginState> {\n        if !path.exists() {\n            return Ok(PackagePluginState {\n                schema_version: STATE_SCHEMA_VERSION,\n                manager: manager.to_string(),\n                packages: BTreeMap::new(),\n            });\n        }\n        let state: PackagePluginState = serde_json::from_str(&crate::file::read_to_string(path)?)\n            .wrap_err_with(|| {\n            format!(\n                \"failed to read package plugin ownership state {}\",\n                crate::file::display_path(path)\n            )\n        })?;\n        if state.schema_version != STATE_SCHEMA_VERSION {\n            bail!(\n                \"unsupported package plugin ownership state version {} in {}\",\n                state.schema_version,\n                crate::file::display_path(path)\n            );\n        }\n        if state.manager != manager {\n            bail!(\n                \"package plugin ownership state {} belongs to manager '{}', not '{manager}'\",\n                crate::file::display_path(path),\n                state.manager\n            );\n        }\n        Ok(state)\n    }\n\n    fn load_state(&self) -> Result<PackagePluginState> {\n        Self::load_state_at(&self.state_path(), &self.name)\n    }","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/plugin.rs#L128-L164","documentation":"Package plugins persist an 'ownership state' file recording which packages they installed, tagged with a schema version. When loading that state, if the file's `schema_version` differs from the version this mise build understands (`STATE_SCHEMA_VERSION`), mise refuses to interpret it rather than guessing at an older/newer layout. This protects against silently misreading a state file written by a different mise version.","triggerScenarios":"Calling any package-plugin operation that loads ownership state (install/uninstall/prune/status flows via `load_state_at`) after the on-disk state file was written by a mise version with a different `STATE_SCHEMA_VERSION`.","commonSituations":"Downgrading mise after the state schema changed; syncing a shared/home-directory state file between machines with different mise versions; a beta or dev build wrote a newer schema that a stable build then reads.","solutions":["Align mise versions between the environments that touch the state file (upgrade the older mise, or downgrade the writer).","Delete the stale ownership state file shown in the message so mise regenerates it; be aware previously plugin-installed packages may need reinstalling via the plugin.","If only one plugin is affected, reinstall its packages through the plugin to rewrite state at the current schema version.","Report the version pair if a same-versioned mise wrote an unexpected schema (bug)."],"exampleFix":"# Inspect and reset the incompatible state file\nmise_path=$(mise where 2>/dev/null); cat <path from error message>\nrm <path from error message>   # mise will recreate it at the current schema version\nmise install   # reinstall plugin packages to rebuild ownership state","handlingStrategy":"validation","validationCode":"// Compare the state file's schema_version with the current mise's before operations\nimport { readFileSync } from 'node:fs';\nconst state = JSON.parse(readFileSync(statePath, 'utf8'));\nif (state.schema_version !== CURRENT_STATE_SCHEMA_VERSION) {\n  console.warn(`State ${statePath} written at schema ${state.schema_version}; align mise versions or delete the file`);\n}","typeGuard":"const hasKnownSchema = (s) => typeof s?.schema_version === 'number' && s.schema_version === CURRENT_STATE_SCHEMA_VERSION;","tryCatchPattern":"try { await misePluginInstall(plugin) } catch (e) { if (String(e).includes('unsupported package plugin ownership state version')) { const p = e.message.match(/state version \\d+ in (\\S+)/)?.[1]; rmSync(p); await misePluginInstall(plugin); } else throw e; }","preventionTips":["Keep the same mise version across machines/users sharing a HOME or state directory.","After downgrading mise, delete regenerated-cache/state files rather than expecting old schemas to load.","Avoid running dev/beta mise builds against state later read by stable builds.","Back up state files before mise major upgrades."],"tags":["state-file","schema-version","package-plugin","migration"],"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"}