{"record":{"id":"68fc25cdababdd51","repo":"jdx/mise","slug":"configuration-disappeared-from-preview-commit","errorCode":null,"errorMessage":"configuration disappeared from preview commit","messagePattern":"configuration disappeared from preview commit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/onboard.rs","lineNumber":91,"sourceCode":"    Ok((temp, preview))\n}\n\nfn preview_configuration(store: &Store) -> Result<tempfile::TempDir> {\n    let temp = tempfile::tempdir()?;\n    let repo = store\n        .repo()\n        .ok_or_else(|| eyre::eyre!(\"preview requires git\"))?;\n    let head = repo\n        .ref_oid(UPSTREAM_REF)?\n        .ok_or_else(|| eyre::eyre!(\"setup preview has no fetched branch\"))?;\n    let encrypted = super::files::encrypted_paths(repo, Some(&head))?;\n    let tracked = crate::system::history::manifest::Manifest::read(repo, &head)?\n        .ok_or_else(|| eyre::eyre!(\"setup repository has no enrollment metadata\"))?\n        .tracking()?;\n    for entry in repo.ls_tree(&head)? {\n        if let Some(relative) = preview_config_path(&tracked, &entry.path)? {\n            let Some((mode, oid)) = repo.object_at(&head, &entry.path)? else {\n                bail!(\"configuration disappeared from preview commit\");\n            };\n            let (mode, oid) = if encrypted.contains(&entry.path) {\n                super::files::decrypt(repo, &entry.path, &(mode, oid), true)?\n            } else {\n                (mode, oid)\n            };\n            crate::system::history::replay::write_path(\n                repo,\n                &temp.path().join(relative),\n                &mode,\n                &oid,\n            )?;\n        }\n    }\n    // Machine-local inputs are not published, but affect the real bootstrap.\n    let local = global_config_dir().join(\"config.local.toml\");\n    if local.is_file() {\n        std::fs::copy(local, temp.path().join(\"config.local.toml\"))?;","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/sync/onboard.rs#L73-L109","documentation":"While building the preview configuration from the snapshot commit, the code iterates ls_tree entries and looks each tracked config path up with object_at. If a path that appeared in ls_tree can no longer be resolved in the head commit, the internal invariant 'every ls-tree entry has an object' is broken and the library bails.","triggerScenarios":"preview_configuration (called from run or the preview decryption test) encounters an ls_tree entry whose blob is missing from the commit — typically a race where the snapshot commit changed between index build and object lookup, or a corrupted/incomplete snapshot where blobs were not fetched.","commonSituations":"The preview snapshot fetch was partial (shallow or filtered fetch dropping blobs); the source repository mutated mid-preview; repository corruption from a crashed process or disk issue.","solutions":["Re-run the onboarding preview so a fresh, complete snapshot is taken.","Verify repository integrity with git fsck on the snapshot repository.","Ensure the snapshot fetch is complete (no partial-clone filters) so all blobs referenced by the head commit are present.","If it recurs, capture the entry path and head oid and report it — this indicates an internal invariant violation or repository corruption."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify all ls_tree entries resolve in the head commit before processing\nfor entry in repo.ls_tree(&head)? {\n    if repo.object_at(&head, &entry.path)?.is_none() {\n        return Err(format!(\"missing object for {} in preview commit\", entry.path));\n    }\n}","typeGuard":null,"tryCatchPattern":"match preview_configuration(&snapshot) {\n    Err(e) if e.to_string().contains(\"configuration disappeared\") => {\n        eprintln!(\"snapshot incomplete or repo mutated; retake the preview snapshot\");\n    }\n    other => other?,\n}","preventionTips":["Retake the preview snapshot if the source repo may have changed mid-preview.","Avoid partial/filtered fetches that omit blobs referenced by the head commit.","Run git fsck periodically on history repositories.","Freeze the source repository (no concurrent writes) while a preview runs."],"tags":["git","internal-error","preview","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}