jdx/mise · error

failed: exit code

Error message

{display_program} {display_args} failed: exit code {}
{}

What it means

This error is raised when an external helper command launched by mise (with display formatting of the program and its args) exits with a non-zero status. The message includes the exit code and the command's trimmed stderr so the underlying failure is visible. It is wrapped with a 'failed to execute command' context if the process could not even be spawned.

Solutions

  1. Read the stderr appended to the error message; it usually contains the real cause from the underlying program.
  2. Run the exact command shown ({display_program} {display_args}) manually to reproduce and fix the underlying failure.
  3. Fix credentials/permissions or missing state (e.g. git auth, missing repo) that made the helper exit non-zero.
  4. If a signal killed the process (exit code -1), check for OOM kills or external termination in dmesg/system logs.

Example fix

// before: command fails deep inside mise with generic exit code
// after: reproduce and fix manually
git -C . status   # run the failing helper args yourself to see the root cause
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the helper's preconditions before invoking mise
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || echo 'not a git repo; helper commands will fail'

Try / catch

match result {
    Err(e) if e.to_string().contains("failed: exit code") => {
        eprintln!("helper stderr: {}", e); // stderr is embedded in the message
        Err(e)
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling mise's helper that runs a program via .output() and checks output.status.success(); the program completes but returns a non-zero exit code, or is terminated by a signal (code() is None, -1 is reported).

Common situations: Git or other VCS helper commands failing due to missing repo, bad credentials, or missing binary output; a tool's support command returning errors because of an invalid environment or wrong arguments supplied by mise.

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


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

Appendix: source

Thrown at src/cmd.rs:2111

    let display_program = program.to_string_lossy();
    let display_args = args.join(" ");
    debug!("$ {display_program} {display_args}");

    let output = tokio::process::Command::new(program)
        .args(args)
        .env_clear()
        .envs(env)
        .stdin(Stdio::null())
        .stdout(Stdio::piped())
        .stderr(Stdio::piped())
        .kill_on_drop(true)
        .output()
        .await
        .wrap_err_with(|| format!("failed to execute command: {display_program} {display_args}"))?;

    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr);
        bail!(
            "{display_program} {display_args} failed: exit code {}\n{}",
            output.status.code().unwrap_or(-1),
            stderr.trim()
        );
    }

    let stdout = String::from_utf8(output.stdout)
        .wrap_err_with(|| format!("{display_program} produced invalid UTF-8 output"))?;
    Ok(stdout.trim_end().to_string())
}

/// Like [`cmd_read_async`] but **inherits** the current process environment,
/// only adding the provided extra variables on top.
///
/// Use this for core plugins that need the ambient PATH / locale / etc.
pub(crate) async fn cmd_read_async_inherited_env<I, K, V>(
    program: &str,
    args: &[&str],

View on GitHub (pinned to 533346cc37)