{"record":{"id":"77b7d1d8fe062246","repo":"jdx/mise","slug":"unsupported-nix-profile-manifest-version-expected-version-3","errorCode":null,"errorMessage":"unsupported Nix profile manifest version {}; expected version 3 (Nix 2.24 or newer)","messagePattern":"unsupported Nix profile manifest version (.+?); expected version 3 \\(Nix 2\\.24 or newer\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/nix.rs","lineNumber":107,"sourceCode":"}\n\n#[derive(Debug, Deserialize)]\n#[serde(rename_all = \"camelCase\")]\nstruct Element {\n    active: bool,\n    original_url: Option<String>,\n    attr_path: Option<String>,\n    outputs: Option<Value>,\n    store_paths: Vec<String>,\n}\n\nimpl Profile {\n    fn parse(json: &str) -> Result<Self> {\n        let profile: Self = serde_json::from_str(json).wrap_err(\n            \"Nix bootstrap requires profile JSON with named entries (Nix 2.24 or newer); upgrade Nix and use a modern `nix profile` profile\",\n        )?;\n        if profile.version != 3 {\n            bail!(\n                \"unsupported Nix profile manifest version {}; expected version 3 (Nix 2.24 or newer)\",\n                profile.version\n            );\n        }\n        Ok(profile)\n    }\n}\n\n#[derive(Deserialize)]\nstruct ParsedReferences {\n    system: String,\n    refs: Vec<Value>,\n}\n\n#[derive(Clone)]\nstruct MatchedEntry {\n    name: String,\n    paths: Vec<String>,","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/nix.rs#L89-L125","documentation":"mise reads the Nix profile manifest (`nix profile list --json`) to determine which packages are installed, and only understands manifest version 3 (or the named-entries JSON shape produced by Nix 2.24+). If the JSON parses but its `version` field is not 3 — typically an older Nix — the parse aborts so mise never misreads an old-format manifest.","triggerScenarios":"`Profile::parse` succeeds deserializing the manifest JSON, but `profile.version` is e.g. 2 or 4 because the system Nix is older/newer than expected while the file shape coincidentally parses.","commonSituations":"Distributions shipping Nix older than 2.24; stale profiles created by an old Nix that persist after upgrading; CI images pinned to an old Nix version.","solutions":["Upgrade Nix to 2.24 or newer (`nix upgrade-nix` or your package manager).","Recreate the profile with the modern Nix so the manifest is rewritten in the current format.","On CI, bump the Nix install action/version to >= 2.24.","If you just upgraded Nix, ensure `nix profile list --profile <path>` reports `\"version\": 3` before running mise."],"exampleFix":"// before (old Nix manifest)\n{\"version\":2,\"elements\":[...]}\n\n// after upgrading Nix >= 2.24\n{\"version\":3,\"elements\":{\"0\":{...}}}","handlingStrategy":"validation","validationCode":"const manifest = JSON.parse(raw);\nif (manifest.version !== 3) {\n  throw new Error(`Nix profile manifest v${manifest.version} unsupported; need Nix >= 2.24`);\n}","typeGuard":"const isV3 = (m: {version: number}) => m.version === 3;","tryCatchPattern":"match Profile::parse(&json) {\n    Err(e) if e.to_string().contains(\"manifest version\") => reinstall_with_modern_nix(),\n    Err(e) => return Err(e),\n    Ok(p) => use(p),\n}","preventionTips":["Pin Nix >= 2.24 in CI images and dev shells","Recreate old profiles after upgrading Nix","Check `nix profile list --json` version field before tooling runs"],"tags":["nix","profile-manifest","version-compatibility","nix-2-24"],"backgroundTag":"unsupported-enum-value","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"}