{"record":{"id":"48538895ba7fd361","repo":"jdx/mise","slug":"python-lock-is-missing-the-requested-root-package","errorCode":null,"errorMessage":"Python lock is missing the requested root package","messagePattern":"Python lock is missing the requested root package","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/backend/pipx/lock.rs","lineNumber":421,"sourceCode":"                .get(\"wheels\")\n                .and_then(toml::Value::as_array)\n                .filter(|v| !v.is_empty())\n                .ok_or_else(|| {\n                    eyre!(\"{name} has no published wheels; Python graph locks require wheels\")\n                })?;\n            for wheel in wheels {\n                let hash = wheel\n                    .get(\"hash\")\n                    .and_then(toml::Value::as_str)\n                    .and_then(|h| h.strip_prefix(\"sha256:\"));\n                if !hash.is_some_and(|h| h.len() == 64 && h.bytes().all(|c| c.is_ascii_hexdigit()))\n                {\n                    bail!(\"{name} has a wheel without a SHA256 hash\");\n                }\n            }\n        }\n        if !root || !virtual_root {\n            bail!(\"Python lock is missing the requested root package\");\n        }\n        validate_portable_urls(&toml::Value::Table(lock.graph.clone()))?;\n        // No arbitrary project settings or build systems are accepted from a lockfile.\n        if lock.project.len() != 1 || project.len() != 4 {\n            bail!(\"unsupported Python lock project settings\");\n        }\n        Ok(())\n    }\n\n    pub(super) async fn install_uv_lock(\n        &self,\n        ctx: &InstallContext,\n        tv: &ToolVersion,\n    ) -> Result<()> {\n        let lock = tv\n            .uv_lock\n            .as_ref()\n            .ok_or_else(|| eyre!(\"missing uv lock\"))?","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/backend/pipx/lock.rs#L403-L439","documentation":"After validating packages, validate_uv_lock requires that the graph actually contains the requested root package (a registry entry matching the normalized tool name and the requested version) AND that the virtual root was seen during traversal. If either flag is false, the lock does not cover the tool being installed and cannot be replayed for it.","triggerScenarios":"Thrown from validate_uv_lock when no package in the lock graph has the normalized tool name with version equal to tv.version, or the virtual root requirement block was never encountered; triggered via prepare_install_version, resolve_uv_lock, or install_uv_lock.","commonSituations":"Lock generated for a different tool or version than the one being installed; lock truncated or corrupted; tool renamed (normalization mismatch between the lock name and tool_name); requesting a version that was never locked.","solutions":["Re-lock the exact tool/version: `mise lock --bump <tool>`.","Confirm the requested version in mise.toml matches what was locked (e.g. resolve a prefix like `pipx:1.2` to a concrete version).","Inspect mise.lock to confirm the root package entry exists with matching name and version.","Delete the lock entry and run `mise lock` to regenerate it for the current request."],"exampleFix":"// before: tool version changed but lock still pins 0.8\nruff = \"pipx:0.9\"   # mise.lock root says 0.8.0\n\n// after\n$ mise lock --bump ruff   # lock root now says 0.9.x","handlingStrategy":"validation","validationCode":"const lock = parseLock('mise.lock');\nif (!lock.packages.some(p => p.name === normalize(tool) && p.version === requestedVersion)) run('mise lock --bump <tool>');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lock the exact tool version you will install (resolve prefixes first)","Verify mise.lock root package after regenerating","Re-lock when switching tool names or versions in mise.toml"],"tags":["python","uv","lockfile","root-package"],"backgroundTag":"record-not-found","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"}