{"record":{"id":"557d11da652bc999","repo":"jdx/mise","slug":"detail-previous-lockfiles-were-preserved","errorCode":null,"errorMessage":"{detail}\nprevious lockfiles were preserved","messagePattern":"(.+?)\nprevious lockfiles were preserved","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lockfile/generate.rs","lineNumber":125,"sourceCode":"                    .iter()\n                    .map(|(_, error)| error.to_string())\n                    .collect::<Vec<_>>()\n                    .join(\"\\n\"),\n            );\n            record_install_failure();\n        }\n        errors\n    }\n}\n\npub(crate) fn record_install_failure() {\n    INSTALL_FAILED.store(true, Ordering::Relaxed);\n}\n\npub(crate) fn ensure_install_succeeded() -> Result<()> {\n    if INSTALL_FAILED.load(Ordering::Relaxed) {\n        if let Some(detail) = INSTALL_FAILURE_DETAIL.lock().unwrap().as_ref() {\n            bail!(\"{detail}\\nprevious lockfiles were preserved\");\n        }\n        bail!(\"installation failed; previous lockfiles were preserved\");\n    }\n    Ok(())\n}\n\npub(crate) fn has_previous_file(config: &Config, path: &Path) -> bool {\n    path.exists()\n        || monorepo_lockfile_migration_paths(config)\n            .iter()\n            .any(|(source, target)| target == path && source.exists())\n}\n\npub(crate) fn read_previous(config: &Config, path: &Path, upgrade: bool) -> Result<Lockfile> {\n    let mut previous = Lockfile::read(path)?;\n    let mut exists = path.exists();\n    for (source, target) in monorepo_lockfile_migration_paths(config) {\n        if target != path || !source.exists() {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/lockfile/generate.rs#L107-L143","documentation":"`ensure_install_succeeded` re-raises a saved install failure at the end of lockfile generation. When the install failed, mise stored the detailed error text in INSTALL_FAILURE_DETAIL so that, after cleaning up, it can surface the original root cause with the reassurance that the previous lockfiles were left untouched (report.abandon() preserved them).","triggerScenarios":"Running `mise lock`/`mise install` with lockfile generation enabled when the underlying tool installation fails (network error during download, backend error, checksum failure); the detailed message stored by the failing backend is re-thrown here with the 'previous lockfiles were preserved' suffix.","commonSituations":"Offline or flaky network during install; registry/backend outage; corrupted cache causing a download/verification failure; unsupported target platform producing a backend error.","solutions":["Read the `{detail}` portion above the suffix — it is the real root-cause error; fix that first.","Retry after fixing connectivity or the backend issue; existing lockfiles are intact so a rerun is safe.","If a specific tool/version fails, pin a working version or remove it from mise.toml and regenerate the lockfile."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// CI: retry once on failure; lockfiles are preserved so retry is safe\nmise lock || (sleep 5 && mise lock) || exit 1","preventionTips":["Ensure network access and registry tokens before running lockfile generation.","Read the detail line above 'previous lockfiles were preserved' — it names the root cause.","Pin known-good tool versions to avoid flaky upstream releases."],"tags":["lockfile","install-failure","network","preserved-state"],"backgroundTag":"http-request-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"}