{"record":{"id":"d4228c8a03181026","repo":"jdx/mise","slug":"display-program-display-args-failed-exit-code","errorCode":null,"errorMessage":"{display_program} {display_args} failed: exit code {}\n{}","messagePattern":"(.+?) (.+?) failed: exit code (.+?)\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd.rs","lineNumber":2111,"sourceCode":"    let display_program = program.to_string_lossy();\n    let display_args = args.join(\" \");\n    debug!(\"$ {display_program} {display_args}\");\n\n    let output = tokio::process::Command::new(program)\n        .args(args)\n        .env_clear()\n        .envs(env)\n        .stdin(Stdio::null())\n        .stdout(Stdio::piped())\n        .stderr(Stdio::piped())\n        .kill_on_drop(true)\n        .output()\n        .await\n        .wrap_err_with(|| format!(\"failed to execute command: {display_program} {display_args}\"))?;\n\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        bail!(\n            \"{display_program} {display_args} failed: exit code {}\\n{}\",\n            output.status.code().unwrap_or(-1),\n            stderr.trim()\n        );\n    }\n\n    let stdout = String::from_utf8(output.stdout)\n        .wrap_err_with(|| format!(\"{display_program} produced invalid UTF-8 output\"))?;\n    Ok(stdout.trim_end().to_string())\n}\n\n/// Like [`cmd_read_async`] but **inherits** the current process environment,\n/// only adding the provided extra variables on top.\n///\n/// Use this for core plugins that need the ambient PATH / locale / etc.\npub(crate) async fn cmd_read_async_inherited_env<I, K, V>(\n    program: &str,\n    args: &[&str],","sourceCodeStart":2093,"sourceCodeEnd":2129,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cmd.rs#L2093-L2129","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the stderr appended to the error message; it usually contains the real cause from the underlying program.","Run the exact command shown ({display_program} {display_args}) manually to reproduce and fix the underlying failure.","Fix credentials/permissions or missing state (e.g. git auth, missing repo) that made the helper exit non-zero.","If a signal killed the process (exit code -1), check for OOM kills or external termination in dmesg/system logs."],"exampleFix":"// before: command fails deep inside mise with generic exit code\n// after: reproduce and fix manually\ngit -C . status   # run the failing helper args yourself to see the root cause","handlingStrategy":"try-catch","validationCode":"// Verify the helper's preconditions before invoking mise\ngit rev-parse --is-inside-work-tree >/dev/null 2>&1 || echo 'not a git repo; helper commands will fail'","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"failed: exit code\") => {\n        eprintln!(\"helper stderr: {}\", e); // stderr is embedded in the message\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Read the stderr embedded in the message first — it carries the root cause","Run the printed program+args manually to reproduce before changing config","Keep credentials and repo state healthy so helper commands succeed"],"tags":["process","exit-code","subprocess"],"backgroundTag":"git-command-failed","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"}