jdx/mise · error · eyre::Report

privileged path inspection returned an unexpected result…

Error message

privileged path inspection returned an unexpected result count

What it means

The privileged helper subprocess (`mise bootstrap __inspect-system-files`, run under sudo) returns a JSON array of path inspections that must line up 1:1 with the requested targets. When the counts diverge — meaning the helper returned malformed or truncated results — mise bails instead of indexing out of bounds. This is an internal consistency check.

Solutions

  1. Re-run the command so sudo re-executes the same (current) mise binary; verify with `which mise` and `mise --version`.
  2. Update mise everywhere on the machine so no stale copy is invoked via sudo.
  3. If it persists, report as a bug — this indicates a corrupted privileged-helper exchange (include `MISE_DEBUG=1` output).
Defensive patterns

Strategy: retry

Try / catch

// retry once after ensuring the same binary is used for sudo re-exec
match run_bootstrap_plan().await {
    Err(e) if e.to_string().contains("unexpected result count") => {
        ensure_single_mise_binary()?;
        run_bootstrap_plan().await
    }
    other => other,
}

Prevention

When it happens

Trigger: The deserialized `Vec<PathInspection>` length differs from `targets.len()` after running the privileged inspect helper; caused by a version mismatch between the invoking mise binary and the binary executed via sudo (different install paths), or corrupted/interleaved subprocess output.

Common situations: mise was upgraded between the unprivileged invocation and the sudo re-exec picking up an older binary on PATH; non-mise output contaminating the child's stdout; a partially failed subprocess still exiting 0.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/ef392a4a18b65cd6. Report an issue: GitHub.

Appendix: source

Thrown at src/system/managed_files.rs:1227

    if privileged.is_empty() {
        return Ok(());
    }
    let input = serde_json::to_vec(&PrivilegedInspectionPlan { paths: privileged })?;
    let executable = std::env::current_exe()?.to_string_lossy().to_string();
    let output = crate::system::sudo::run_with_input_output(
        &executable,
        &[
            "--no-config".to_string(),
            "--no-env".to_string(),
            "--no-hooks".to_string(),
            "bootstrap".to_string(),
            "__inspect-system-files".to_string(),
        ],
        &input,
    )?;
    let inspections: Vec<PathInspection> = serde_json::from_slice(&output)?;
    if inspections.len() != targets.len() {
        bail!("privileged path inspection returned an unexpected result count");
    }
    for (target, inspection) in targets.into_iter().zip(inspections) {
        match target {
            Target::File(index) => files[index].inspection = Some(inspection),
            Target::Directory(index) => directories[index].inspection = Some(inspection),
        }
    }
    Ok(())
}

fn plan_directory(request: &ManagedDirectoryRequest) -> Result<ResourcePlan> {
    let desired = match request.state {
        ManagedState::Present => desired_metadata(
            "directory",
            request.mode,
            request.owner.as_deref(),
            request.group.as_deref(),
        ),

View on GitHub (pinned to 533346cc37)