{"record":{"id":"d42930c911ab679d","repo":"jdx/mise","slug":"exited-with-non-zero-status-status","errorCode":null,"errorMessage":"exited with non-zero status: {status}","messagePattern":"exited with non-zero status: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd.rs","lineNumber":1462,"sourceCode":"            };\n            if let Err(err) = consume(output) {\n                #[cfg(unix)]\n                signal_process_tree(id, nix::sys::signal::Signal::SIGKILL);\n                #[cfg(windows)]\n                kill_process_tree(id);\n                return Err(err);\n            }\n        }\n\n        if let Some(guard) = &timeout_guard {\n            guard.cancel();\n        }\n        let status = status.expect(\"command wait must complete\");\n        if !status.success() {\n            if let Some(timeout) = timeout_guard.as_ref().and_then(|guard| guard.timed_out()) {\n                bail!(\"timed out after {timeout:?}\");\n            }\n            bail!(\"exited with non-zero status: {status}\");\n        }\n        Ok((\n            stdout_hasher.finalize().to_hex().to_string(),\n            stderr_hasher.finalize().to_hex().to_string(),\n        ))\n    }\n\n    /// Run the command and return stdout, even when raw mode is enabled.\n    pub(crate) async fn read(mut self) -> Result<String> {\n        let _read_lock = RAW_LOCK.read().await;\n        debug!(\"$ {self}\");\n        self.cmd.kill_on_drop(true);\n        #[cfg(unix)]\n        if should_use_pgroup() {\n            self.cmd.env(TASK_PGID_MANAGED_ENV, \"1\");\n            unsafe {\n                self.cmd.as_std_mut().pre_exec(|| {\n                    let stdin = std::os::fd::BorrowedFd::borrow_raw(0);","sourceCodeStart":1444,"sourceCodeEnd":1480,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cmd.rs#L1444-L1480","documentation":"The executed command finished but returned a non-zero exit status, and no timeout was involved. In this hashed-runner path the command's stdout/stderr are consumed internally for hashing, so mise reports only the status string (e.g. `exited with non-zero status: exit status: 1`) rather than replaying captured output.","triggerScenarios":"Raised at src/cmd.rs:1462 in execute_hashes_async_with_drain_timeout whenever `status.success()` is false and `timeout_guard.timed_out()` is None — any failing command executed via execute_hashes_async (non-interactive probes with piped, hashed output).","commonSituations":"Version-check or probe commands failing because the tool isn't installed correctly, a config file referenced by the command is invalid, network calls inside the command fail, or the script itself exits non-zero by design.","solutions":["Run the same command manually in your shell to see its real error output (this path hides it for hashing).","Fix the underlying command failure (missing tool, bad flags, invalid config, network error).","If non-zero is expected/acceptable, guard the call (`cmd || true`) or use a runner variant that tolerates failure.","Check that PATH/env inside mise matches your shell (mise shims vs system tools can resolve differently)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Reproduce the probe locally and check its exit status first:\n$ mise exec -- sh -c 'cmd args'; echo \"exit=$?\"","typeGuard":null,"tryCatchPattern":"match runner.execute_hashes().await {\n    Err(e) if e.to_string().contains(\"exited with non-zero status\") => {\n        eprintln!(\"probe failed; run the command manually for details: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Run any command used as a probe manually once to confirm it exits 0 in a clean env.","Keep PATH/env assumptions minimal — mise's env can differ from your shell.","Make scripts exit 0 on expected 'not found' outcomes rather than failing.","Log the command line alongside the error so failures are diagnosable."],"tags":["exit-code","subprocess","process"],"backgroundTag":"command-exit-nonzero","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}