{"record":{"id":"6d08fde07b8ad556","repo":"jdx/mise","slug":"incompatible-monorepo-lockfile-formats-run-mise-lock-upgrade","errorCode":null,"errorMessage":"incompatible monorepo lockfile formats; run `mise lock --upgrade`","messagePattern":"incompatible monorepo lockfile formats; run `mise lock --upgrade`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lockfile/generate.rs","lineNumber":155,"sourceCode":"}\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() {\n            continue;\n        }\n        let legacy = Lockfile::read(&source)?;\n        if !exists {\n            previous.lockfile_version = legacy.lockfile_version;\n            previous\n                .generated_header_url\n                .clone_from(&legacy.generated_header_url);\n            exists = true;\n        } else if previous.lockfile_version != legacy.lockfile_version {\n            if !upgrade {\n                bail!(\"incompatible monorepo lockfile formats; run `mise lock --upgrade`\");\n            }\n            previous.lockfile_version = previous.lockfile_version.max(legacy.lockfile_version);\n        }\n        merge_lockfile_preserving_root(&mut previous, legacy);\n    }\n    Ok(previous)\n}\n\npub(crate) async fn prepare_install(config: &Arc<Config>, tv: &ToolVersion) -> Result<()> {\n    let Some((path, _)) = lockfile_path_for_tool_source(config, tv.request.source()) else {\n        return Ok(());\n    };\n    if !has_previous_file(config, &path)\n        && (!config.lockfile_creation_enabled()\n            || tv\n                .request\n                .source()\n                .path()","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/lockfile/generate.rs#L137-L173","documentation":"When reading the previous lockfile state for generation (`read_previous`, called from prepare_install), mise merges legacy monorepo subproject lockfiles into the root lockfile. If their lockfile_versions differ and `--upgrade` was not requested, the formats are incompatible for merging, so it stops and tells you to run `mise lock --upgrade` at the monorepo root, which permits taking the max version and migrating.","triggerScenarios":"Running `mise lock` (or any command triggering prepare_install) in a monorepo where a legacy subproject lockfile with a different lockfile_version coexists with the root lockfile and no `--upgrade` flag was passed.","commonSituations":"Partially migrated monorepo after upgrading mise: some checkouts still carry old subproject lockfiles; merging branches where one regenerated the lockfile format; CI environments pinned to an older mise writing older-format lockfiles.","solutions":["Run `mise lock --upgrade` at the monorepo root to migrate all subproject lockfiles into the newer root format.","Remove/commit stale legacy subproject lockfiles so only the root lockfile remains.","Align the mise version (and lockfile format) across the team and CI, then regenerate and commit the root lockfile."],"exampleFix":"// before\nmise lock            # incompatible monorepo lockfile formats\n// after\ncd <monorepo-root>\nmise lock --upgrade  # migrates legacy subproject lockfiles\ngit add mise.lock && git commit -m \"chore: upgrade mise lockfile format\"","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["After any mise upgrade, run `mise lock --upgrade` at the monorepo root once and commit the result.","Delete legacy subproject mise.lock files once the monorepo root lockfile is in place.","Standardize the mise version in CI to match the one that wrote the lockfile format."],"tags":["lockfile","monorepo","migration","format-version"],"backgroundTag":"incompatible-source-type","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"}