jdx/mise · error

pnpm lockfile dependency {name:?} has no resolvable version

Error message

pnpm lockfile dependency {name:?} has no resolvable version

What it means

While walking a pnpm lockfile to derive task workspace package keys (dependency_package_keys), mise reads each dependency entry and extracts its version either from a plain string value or from a `version` key in the dependency object. When neither yields a string, the dependency has no version that can be resolved against the lockfile's package snapshots, so mise aborts rather than silently mis-mapping the dependency graph.

Source

Thrown at src/task/workspace/node.rs:397

    }
    Ok(reachable)
}

fn dependency_package_keys(node: &Value, available: &BTreeSet<String>) -> Result<Vec<String>> {
    let mut packages = Vec::new();
    for field in ["dependencies", "devDependencies", "optionalDependencies"] {
        let Some(dependencies) = node.get(field).and_then(Value::as_mapping) else {
            continue;
        };
        for (name, value) in dependencies {
            let Some(name) = name.as_str() else {
                continue;
            };
            let version = value
                .as_str()
                .or_else(|| value.get("version").and_then(Value::as_str));
            let Some(version) = version else {
                eyre::bail!("pnpm lockfile dependency {name:?} has no resolvable version");
            };
            packages.extend(resolve_package_keys(name, version, available)?);
        }
    }
    Ok(packages)
}

fn resolve_package_keys(
    name: &str,
    version: &str,
    available: &BTreeSet<String>,
) -> Result<Vec<String>> {
    if ["link:", "workspace:", "file:"]
        .iter()
        .any(|prefix| version.starts_with(prefix))
    {
        return Ok(Vec::new());
    }

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Regenerate pnpm-lock.yaml with `pnpm install` so every dependency entry carries a resolvable version
  2. Inspect the lockfile entry for the named dependency and remove or fix malformed entries (merge leftovers, link:/file: deps without versions)
  3. Check your pnpm version and lockfileVersion compatibility; commit a lockfile format the current mise supports

Example fix

// before (pnpm-lock.yaml, malformed entry)
dependencies:
  left-pad:
    specifier: ^1.0.0

// after
dependencies:
  left-pad:
    specifier: ^1.0.0
    version: 1.3.0
Defensive patterns

Strategy: validation

Validate before calling

// before trusting a pnpm lockfile entry
const version = typeof dep === 'string' ? dep : (typeof dep === 'object' && typeof dep.version === 'string' ? dep.version : null);
if (!version) throw new Error(`dependency ${name} has no resolvable version; run pnpm install`);

Type guard

function hasVersion(d) { return typeof d === 'string' || (d !== null && typeof d === 'object' && typeof d.version === 'string'); }

Prevention

When it happens

Trigger: Calling reachable_packages over a pnpm-lock.yaml where a dependency entry is neither a version string nor an object containing a string `version` field — e.g. a lockfile v9 entry with only a specifier, a `link:`/`file:` dependency with no version, or a hand-edited/corrupted lockfile.

Common situations: Hand-edited pnpm lockfiles; pnpm workspaces using `link:` workspace protocol deps whose entries carry only a resolution/specifier; lockfiles produced by a much newer pnpm than the parser anticipates; merge conflicts resolved incorrectly in pnpm-lock.yaml.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/7d7500178a2137dc. Report an issue: GitHub.