jdx/mise · error · eyre::Report

elevated bootstrap helper failed with {}

Error message

elevated bootstrap helper failed with {}

What it means

Sibling of the run_with_input failure, raised by run_with_input_output: this variant pipes the private stdin payload, captures stdout for the caller, and inherits only stderr. It fires when the elevated helper exits non-zero; the captured stdout is discarded and only the ExitStatus is reported. The helper's own diagnostics were printed to the terminal through inherited stderr.

Source

Thrown at src/system/sudo.rs:246

        .chain(args.iter().cloned())
        .collect::<Vec<_>>()
        .join(" ");
    ensure_elevation_available(&manual_cmd)?;
    info!("$ {}", argv.join(" "));
    let mut child = Command::new(&argv[0])
        .args(&argv[1..])
        .stdin(Stdio::piped())
        .stdout(Stdio::piped())
        .stderr(Stdio::inherit())
        .spawn()?;
    child
        .stdin
        .take()
        .expect("piped stdin is available")
        .write_all(input)?;
    let output = child.wait_with_output()?;
    if !output.status.success() {
        bail!("elevated bootstrap helper failed with {}", output.status);
    }
    Ok(output.stdout)
}

fn ensure_elevation_available(manual_cmd: &str) -> Result<()> {
    if is_root() {
        return Ok(());
    }
    if !Settings::get().system_packages.sudo {
        bail!(
            "not running as root and system_packages.sudo is disabled. Run manually:\n  {manual_cmd}"
        );
    }
    if crate::file::which("sudo").is_none() {
        bail!(
            "sudo not found. Run as root:\n  {}",
            manual_cmd.trim_start_matches("sudo ")
        );

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Check the inherited stderr above the error for the helper's own message
  2. Run the helper manually with the same stdin payload to reproduce the exit code
  3. Refresh sudo credentials with `sudo -v` before the mise operation, or configure NOPASSWD for the specific helper
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify sudo works non-interactively before calling an elevated output-capturing helper
use std::process::Command;
fn elevation_ok() -> bool {
    Command::new("sudo").arg("-n").arg("true").output().map(|o| o.status.success()).unwrap_or(false)
}

Try / catch

let stdout = match run_with_input_output(&prog, &args, input) {
    Ok(out) => out,
    Err(err) if err.to_string().contains("elevated bootstrap helper failed") => {
        // fall back to prompting the user to run the printed manual command
        return Ok(Vec::new());
    }
    Err(err) => return Err(err),
};

Prevention

When it happens

Trigger: Calling run_with_input_output for an elevated helper that is expected to return data on stdout (e.g. a query-style privileged helper); the sudo child exits non-zero due to bad credentials, helper-level errors, or a signal.

Common situations: Expired sudo timestamp in long-running sessions; helper script exiting on its own validation errors; CI runners without valid sudo credentials.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/5833fd97232bab8e. Report an issue: GitHub.