{"record":{"id":"2b3ca7085eccd536","repo":"BloopAI/vibe-kanban","slug":"failed-to-spawn-stdio-command-e","errorCode":null,"errorMessage":"Failed to spawn stdio command: {e}","messagePattern":"Failed to spawn stdio command: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/embedded-ssh/src/handler.rs","lineNumber":93,"sourceCode":"                // Non-interactive shell reading commands from stdin.\n                cmd.arg(\"-s\");\n            }\n        }\n\n        cmd.stdin(Stdio::piped());\n        cmd.stdout(Stdio::piped());\n        cmd.stderr(Stdio::piped());\n        cmd.env(\"TERM\", \"xterm-256color\");\n        for (k, v) in env {\n            cmd.env(k, v);\n        }\n        if let Ok(home) = std::env::var(\"HOME\") {\n            cmd.current_dir(home);\n        }\n\n        let mut child = cmd\n            .spawn()\n            .map_err(|e| anyhow::anyhow!(\"Failed to spawn stdio command: {e}\"))?;\n\n        let stdin = child\n            .stdin\n            .take()\n            .ok_or_else(|| anyhow::anyhow!(\"Failed to take child stdin\"))?;\n        let stdout = child\n            .stdout\n            .take()\n            .ok_or_else(|| anyhow::anyhow!(\"Failed to take child stdout\"))?;\n        let stderr = child\n            .stderr\n            .take()\n            .ok_or_else(|| anyhow::anyhow!(\"Failed to take child stderr\"))?;\n\n        let (writer_tx, mut writer_rx) = mpsc::channel::<Vec<u8>>(64);\n        tokio::spawn(async move {\n            let mut stdin = stdin;\n            while let Some(data) = writer_rx.recv().await {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/crates/embedded-ssh/src/handler.rs#L75-L111","documentation":"After building the stdio command (respecting env and HOME cwd), spawn_stdio_session calls Command::spawn(). If the OS fails to start the child process, the io::Error is wrapped into this anyhow error. It means the process never started — nothing to do with the SSH channel itself.","triggerScenarios":"The requested shell/exec command binary does not exist or is not executable, PATH lacks the binary, permission is denied, or the exec'ed program string is malformed so the spawned command cannot be launched.","commonSituations":"Minimal container images without the user's login shell (e.g. no /bin/bash), restricted environments with missing PATH, users exec-ing custom commands not installed on the host, or a HOME dir set to a nonexistent path (though that only affects cwd).","solutions":["Verify the command binary exists and is executable on the host (which <cmd>, check PATH inside the SSH server's environment).","Use an absolute path to the shell/binary (e.g. /bin/sh) instead of relying on PATH resolution.","Check file permissions and that the server user is allowed to execute the binary.","Log the underlying io::Error (embedded in the message) to distinguish NotFound vs PermissionDenied and fix accordingly."],"exampleFix":"// before\nchannel.exec(\"my-tool --version\"); // my-tool not on PATH\n// after\nchannel.exec(\"/usr/local/bin/my-tool --version\"); // or install my-tool on the host","handlingStrategy":"try-catch","validationCode":"// check the binary resolves before exec\nlet ok = std::process::Command::new(\"sh\")\n    .args([\"-c\", \"command -v my-tool\"])\n    .output()\n    .map(|o| o.status.success())\n    .unwrap_or(false);","typeGuard":null,"tryCatchPattern":"match handler.spawn_stdio_session(session, channel_id, env).await {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"Failed to spawn stdio command\") => {\n        let msg = e.to_string();\n        if msg.contains(\"No such file\") {\n            // report 'command not found' to the SSH client\n        } else if msg.contains(\"Permission denied\") {\n            // report permissions problem\n        }\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use absolute paths for shells/binaries in exec requests.","Verify the target command exists in the server host's PATH/container image.","Confirm execute permissions for the server's user account.","Keep a minimal known-good shell (e.g. /bin/sh) available in deployment images."],"tags":["process-spawn","ssh","command-not-found"],"backgroundTag":"process-spawn-failed","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}