{"record":{"id":"54b9ba474cacd034","repo":"zellij-org/zellij","slug":"process-returned-non-zero-exit-code","errorCode":null,"errorMessage":"Process returned non-zero exit code: {}","messagePattern":"Process returned non-zero exit code: (.+?)","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"zellij-client/src/lib.rs","lineNumber":479,"sourceCode":"/// On Unix the server daemonizes (double-fork) inside start_server(), so\n/// the intermediate child exits immediately and `cmd.status()` returns.\n#[cfg(not(windows))]\npub fn spawn_server(socket_path: &Path, debug: bool) -> io::Result<()> {\n    let mut cmd = Command::new(current_exe()?);\n    cmd.arg(\"--server\").arg(socket_path);\n    if debug {\n        cmd.arg(\"--debug\");\n    }\n    let status = cmd.status()?;\n    if status.success() {\n        Ok(())\n    } else {\n        let msg = \"Process returned non-zero exit code\";\n        let err_msg = match status.code() {\n            Some(c) => format!(\"{}: {}\", msg, c),\n            None => msg.to_string(),\n        };\n        Err(io::Error::new(io::ErrorKind::Other, err_msg))\n    }\n}\n\n/// Spawn the Zellij server process.\n///\n/// On Windows there is no daemonize — we launch the server as a background\n/// process with a hidden console.  We use CREATE_NO_WINDOW (not\n/// DETACHED_PROCESS) so the server gets valid standard handles;\n/// DETACHED_PROCESS leaves stdin/stdout/stderr as NULL, which breaks PTY\n/// creation, WASM plugin loading, and logging.\n#[cfg(windows)]\npub fn spawn_server(socket_path: &Path, debug: bool) -> io::Result<()> {\n    use std::os::windows::process::CommandExt;\n    let mut cmd = Command::new(current_exe()?);\n    cmd.arg(\"--server\").arg(socket_path);\n    if debug {\n        cmd.arg(\"--debug\");\n    }","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/zellij-org/zellij/blob/e839bfffa586992364309a685b2c71f3b23c247e/zellij-client/src/lib.rs#L461-L497","documentation":"Error \"Process returned non-zero exit code: {}\" thrown in zellij-org/zellij.","triggerScenarios":"Occurs at zellij-client/src/lib.rs:474 when the operation fails: \"Process returned non-zero exit code: {}\". Currently there is no defensive handling preventing or contextualizing this failure before it surfaces.","commonSituations":"Setup/check commands or external tools failing in the user environment.","solutions":["Run the reported command manually to see its stderr and fix the underlying problem.","Check the command's documentation for the meaning of its exit code."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e839bfffa586992364309a685b2c71f3b23c247e","analyzedAt":"2026-08-19T07:42:58.758Z","contentChangedAt":"2026-08-19T07:42:58.758Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}