{"record":{"id":"5833fd97232bab8e","repo":"jdx/mise","slug":"elevated-bootstrap-helper-failed-with","errorCode":null,"errorMessage":"elevated bootstrap helper failed with {}","messagePattern":"elevated bootstrap helper failed with (.+?)","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/system/sudo.rs","lineNumber":246,"sourceCode":"        .chain(args.iter().cloned())\n        .collect::<Vec<_>>()\n        .join(\" \");\n    ensure_elevation_available(&manual_cmd)?;\n    info!(\"$ {}\", argv.join(\" \"));\n    let mut child = Command::new(&argv[0])\n        .args(&argv[1..])\n        .stdin(Stdio::piped())\n        .stdout(Stdio::piped())\n        .stderr(Stdio::inherit())\n        .spawn()?;\n    child\n        .stdin\n        .take()\n        .expect(\"piped stdin is available\")\n        .write_all(input)?;\n    let output = child.wait_with_output()?;\n    if !output.status.success() {\n        bail!(\"elevated bootstrap helper failed with {}\", output.status);\n    }\n    Ok(output.stdout)\n}\n\nfn ensure_elevation_available(manual_cmd: &str) -> Result<()> {\n    if is_root() {\n        return Ok(());\n    }\n    if !Settings::get().system_packages.sudo {\n        bail!(\n            \"not running as root and system_packages.sudo is disabled. Run manually:\\n  {manual_cmd}\"\n        );\n    }\n    if crate::file::which(\"sudo\").is_none() {\n        bail!(\n            \"sudo not found. Run as root:\\n  {}\",\n            manual_cmd.trim_start_matches(\"sudo \")\n        );","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/sudo.rs#L228-L264","documentation":"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.","triggerScenarios":"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.","commonSituations":"Expired sudo timestamp in long-running sessions; helper script exiting on its own validation errors; CI runners without valid sudo credentials.","solutions":["Check the inherited stderr above the error for the helper's own message","Run the helper manually with the same stdin payload to reproduce the exit code","Refresh sudo credentials with `sudo -v` before the mise operation, or configure NOPASSWD for the specific helper"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify sudo works non-interactively before calling an elevated output-capturing helper\nuse std::process::Command;\nfn elevation_ok() -> bool {\n    Command::new(\"sudo\").arg(\"-n\").arg(\"true\").output().map(|o| o.status.success()).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"let stdout = match run_with_input_output(&prog, &args, input) {\n    Ok(out) => out,\n    Err(err) if err.to_string().contains(\"elevated bootstrap helper failed\") => {\n        // fall back to prompting the user to run the printed manual command\n        return Ok(Vec::new());\n    }\n    Err(err) => return Err(err),\n};","preventionTips":["Cache sudo credentials (`sudo -v`) at the start of scripted runs","Scope NOPASSWD sudoers rules to the exact helper binaries invoked","Treat any helper exit-status failure as an environment problem first - inspect inherited stderr before blaming mise"],"tags":["sudo","elevation","system-packages","process-exit","stdout-capture"],"backgroundTag":"sudo-command-failed","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}