jdx/mise · error
failed
Error message
{} failed What it means
mise ran an elevated command via sudo (with `fchdir` into the target directory) and the child process exited with a non-zero status. The error message is the full argument vector that failed; the actual error output was inherited by the terminal (stdio is not captured in `run_in_dir`, so sudo password prompts and the command's own stderr appear directly).
Solutions
- Check the command's output printed in the terminal just before the error for the real cause
- Run the exact `sudo <program> <args>` shown by `failed to run ...` manually to reproduce
- Verify sudoers permits the command (`sudo -l`), and authenticate with `sudo -v` beforehand in non-interactive contexts
- Fix the underlying failure (network, disk, package errors) and re-run
Example fix
// before: failing due to missing sudoers rule sudo mise bootstrap install-service // after: grant the rule then retry // /etc/sudoers.d/mise: youruser ALL=(root) NOPASSWD: /usr/local/bin/mise sudo mise bootstrap install-service
Defensive patterns
Strategy: try-catch
Validate before calling
sudo -n true 2>/dev/null && sudo -l | grep -q <program> && echo "elevation available"
Try / catch
match sudo::run_in_dir(prog, args, dir) { Err(e) if e.ends_with("failed") => inspect_child_output_and_retry(), other => other } Prevention
- Run `sudo -v` interactively before non-interactive elevated commands
- Add required commands to sudoers (NOPASSWD) for CI environments
- Review the command's inherited stderr output before the error line for the root cause
When it happens
Trigger: `run_in_dir` spawns `sudo <program> <args>` and `cmd.status()` reports failure — e.g. `sudo mkdir` denied by sudoers, `sudo apt install` failing to fetch packages, or the underlying program exiting non-zero under elevation.
Common situations: Sudoers policy not permitting the command for the user; sudo credentials expired and no TTY for the prompt; package manager failures during privileged setup; disk-full or network errors inside the elevated command.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- elevated bootstrap helper failed with
- elevated bootstrap helper failed with
- not running as root and system_packages.sudo is disabled…
- sudo not found. Run as root
- sudo requires a password but no TTY is available. Run…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/ce1958d8c72f5112.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/sudo.rs:180
let raw = dir.as_fd().as_raw_fd();
let mut cmd = Command::new(&argv[0]);
cmd.args(&argv[1..]);
// SAFETY: `fchdir` is async-signal-safe and only alters the child's working
// directory. `raw` stays open in the parent across the spawn, and CLOEXEC
// (if set) only takes effect at exec, after pre_exec has run.
unsafe {
cmd.pre_exec(move || {
if nix::libc::fchdir(raw) == -1 {
return Err(std::io::Error::last_os_error());
}
Ok(())
});
}
let status = cmd
.status()
.wrap_err_with(|| format!("failed to run {}", argv.join(" ")))?;
if !status.success() {
bail!("{} failed", argv.join(" "));
}
Ok(())
}
/// Run an elevated command and capture its output.
///
/// Interactive callers authenticate with an inherited `sudo -v` first so a
/// password prompt is never hidden inside captured stderr. Non-interactive
/// callers retain [`ensure_elevation_available`]'s fail-fast `sudo -n` check.
pub(crate) fn output(program: &str, args: &[String], envs: &[(String, String)]) -> Result<Output> {
let argv = argv_with_env(program, args, envs);
let manual_cmd = std::iter::once("sudo".to_string())
.chain((!envs.is_empty()).then_some("env".to_string()))
.chain(envs.iter().map(|(key, value)| format!("{key}={value}")))
.chain(std::iter::once(program.to_string()))
.chain(args.iter().cloned())
.collect::<Vec<_>>()
.join(" ");View on GitHub (pinned to 533346cc37)