{"record":{"id":"0c433ecb590f0d99","repo":"jdx/mise","slug":"python-lock-does-not-match-the-requested-tool-run-mise-lock","errorCode":null,"errorMessage":"Python lock does not match the requested tool; run `mise lock --bump {}`","messagePattern":"Python lock does not match the requested tool; run `mise lock --bump (.+?)`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/backend/pipx/lock.rs","lineNumber":326,"sourceCode":"    }\n\n    pub(crate) fn validate_uv_lock(&self, tv: &ToolVersion, lock: &UvLock) -> Result<()> {\n        self.validate_lock_options(tv)?;\n        let project = lock\n            .project\n            .get(\"project\")\n            .and_then(toml::Value::as_table)\n            .ok_or_else(|| eyre!(\"missing uv project\"))?;\n        let expected = self\n            .lock_requirements(tv)?\n            .into_iter()\n            .map(toml::Value::String)\n            .collect::<Vec<_>>();\n        if project.get(\"dependencies\").and_then(toml::Value::as_array) != Some(&expected)\n            || project.get(\"name\").and_then(toml::Value::as_str) != Some(PROJECT_NAME)\n            || project.get(\"requires-python\") != lock.graph.get(\"requires-python\")\n        {\n            bail!(\n                \"Python lock does not match the requested tool; run `mise lock --bump {}`\",\n                self.ba.short\n            );\n        }\n        let packages = lock\n            .graph\n            .get(\"package\")\n            .and_then(toml::Value::as_array)\n            .ok_or_else(|| eyre!(\"missing uv packages\"))?;\n        let mut root = false;\n        let mut virtual_root = false;\n        for package in packages {\n            let package = package\n                .as_table()\n                .ok_or_else(|| eyre!(\"invalid uv package\"))?;\n            let name = package\n                .get(\"name\")\n                .and_then(toml::Value::as_str)","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/backend/pipx/lock.rs#L308-L344","documentation":"Before replaying a uv lock, validate_uv_lock checks that the embedded pyproject-style project table still matches what the tool request needs: the dependencies list, the synthetic project name (mise-pypi-tool-environment), and requires-python must line up with the current request. If any differ, the lock is stale relative to the request and mise refuses to install from it, telling you to regenerate it with `mise lock --bump`.","triggerScenarios":"Thrown from validate_uv_lock (called by prepare_install_version, resolve_uv_lock, install_uv_lock) when the stored UvLock's project.dependencies array differs from the expected dependency built from the request, the project name is not `mise-pypi-tool-environment`, or `requires-python` differs between the project table and the graph.","commonSituations":"The mise.lock was edited or generated by an older mise version with different lock schema content; the tool version or extras were changed in mise.toml without re-locking; someone hand-edited the lockfile; the lock was produced for a different tool version and needs bumping.","solutions":["Regenerate the lock: `mise lock --bump <tool>` (as the message suggests).","Revert manual edits to mise.lock or delete it and run `mise lock` again.","If you intentionally changed the tool version/extras in mise.toml, re-run lock so the recorded dependencies match.","Update mise if the lock was written by a much older version with a different project-table schema."],"exampleFix":"// before: mise.toml bumped the tool but the lock still lists the old version\nruff = \"pipx:0.9\"\n\n// after: regenerate the lock to match\n$ mise lock --bump ruff","handlingStrategy":"validation","validationCode":"// after editing mise.toml tool versions/extras, re-lock\nrun('mise lock --bump <tool>');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run `mise lock --bump` after changing tool versions or extras","Never hand-edit mise.lock project tables","Keep mise updated so lock schema stays consistent"],"tags":["python","uv","lockfile","stale-lock"],"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"}