{"record":{"id":"0fde28e0c35f8d4b","repo":"affaan-m/ECC","slug":"child-stdout-was-not-piped","errorCode":null,"errorMessage":"Child stdout was not piped","messagePattern":"Child stdout was not piped","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"ecc2/src/session/runtime.rs","lineNumber":158,"sourceCode":"    mut command: Command,\n    output_store: SessionOutputStore,\n    heartbeat_interval: std::time::Duration,\n) -> Result<ExitStatus> {\n    let db_writer = DbWriter::start(db_path, session_id.clone());\n\n    let result = async {\n        let mut child = command\n            .stdout(Stdio::piped())\n            .stderr(Stdio::piped())\n            .spawn()\n            .with_context(|| format!(\"Failed to start process for session {}\", session_id))?;\n\n        let stdout = match child.stdout.take() {\n            Some(stdout) => stdout,\n            None => {\n                let _ = child.kill().await;\n                let _ = child.wait().await;\n                anyhow::bail!(\"Child stdout was not piped\");\n            }\n        };\n        let stderr = match child.stderr.take() {\n            Some(stderr) => stderr,\n            None => {\n                let _ = child.kill().await;\n                let _ = child.wait().await;\n                anyhow::bail!(\"Child stderr was not piped\");\n            }\n        };\n\n        let pid = child\n            .id()\n            .ok_or_else(|| anyhow::anyhow!(\"Spawned process did not expose a process id\"))?;\n        db_writer.update_pid(Some(pid)).await?;\n        db_writer.update_state(SessionState::Running).await?;\n        db_writer.touch_heartbeat().await?;\n","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/ecc2/src/session/runtime.rs#L140-L176","documentation":"capture_command_output requires the spawned child's stdout to be piped (Stdio::piped) so output can be persisted; child.stdout.take() returned None despite the spawn call. This is an invariant violation indicating the Command was constructed without piped stdout; the child is killed and reaped before bailing.","triggerScenarios":"Thrown at ecc2/src/session/runtime.rs:158 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Spawn the child process with stdout set to piped before reading it.","Ensure no earlier code consumed or detached the stdout handle."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06c5e118c4d3e6c3b7f9445f973a2194c82de193","analyzedAt":"2026-08-18T11:27:13.915Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}