{"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":null,"httpStatus":null,"severity":"error","filePath":"src/system/sudo.rs","lineNumber":272,"sourceCode":"        .collect::<Vec<_>>()\n        .join(\" \");\n    ensure_elevation_available(&manual_cmd)?;\n    let _progress_pause = pause_progress_for_child();\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\n/// Verify that a subprocess which performs its own sudo elevation can do so\n/// without violating mise's elevation policy or hanging without a TTY.\npub(crate) fn 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  {}\",","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/sudo.rs#L254-L290","documentation":"run_with_input_output pipes a private stdin payload into an elevated helper, waits, and captures stdout. If the helper exits non-zero, mise bails with the ExitStatus formatted in and discards nothing else; stderr was already forwarded to the terminal for sudo prompts and diagnostics. Same meaning as the run_with_input variant but for helpers whose stdout must be captured.","triggerScenarios":"Calling run_with_input_output in src/system/sudo.rs when the elevated subprocess terminates with a non-zero exit code after consuming the piped stdin payload.","commonSituations":"Elevated query command fails (e.g. dpkg/rpm query for a nonexistent package); script passed via stdin errors mid-run; sudo target command is rejected by policy (e.g. sudoers restrictions on the exact command).","solutions":["Read the helper's stderr printed on the terminal to find the real failure","Verify the stdin payload/script is correct for the target platform and package manager","Check sudoers policy allows the exact command being run without restrictions","Retry after fixing; if the command genuinely can't be elevated, run it manually as root using the suggested manual command"],"exampleFix":"// before\nlet out = run_with_input_output(&mut cmd, script.as_bytes())?;\n// after\nlet out = run_with_input_output(&mut cmd, script.as_bytes())\n    .with_context(|| format!(\"elevated helper for {pkg} failed; check terminal stderr\"))?;","handlingStrategy":"try-catch","validationCode":"// verify the queried entity exists before the elevated call\nif !Path::new(&target).exists() { bail!(\"nothing to query at {target}\"); }","typeGuard":"fn status_ok(o: &std::process::Output) -> bool { o.status.success() }","tryCatchPattern":"let out = run_with_input_output(&mut cmd, input)\n    .with_context(|| \"elevated helper failed; check terminal stderr for sudo/diagnostic output\")?;","preventionTips":["Keep stderr attached to a terminal when running helpers so sudo prompts and errors are visible","Confirm sudoers policy permits the exact command non-interactively if used in automation","Validate the stdin payload against the target platform before invoking"],"tags":["sudo","subprocess","elevation","exit-status"],"backgroundTag":"command-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"}