{"record":{"id":"9ce3a39a1bd76ee9","repo":"tinyhumansai/openhuman","slug":"claude-child-stderr-missing","errorCode":null,"errorMessage":"claude child stderr missing","messagePattern":"claude child stderr missing","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/inference/provider/claude_code/driver.rs","lineNumber":410,"sourceCode":"    if let Some(mut stdin) = child.stdin.take() {\n        stdin\n            .write_all(&stdin_bytes)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"write stdin: {e}\"))?;\n        stdin\n            .shutdown()\n            .await\n            .map_err(|e| anyhow::anyhow!(\"close stdin: {e}\"))?;\n    }\n\n    let mut stdout = child\n        .stdout\n        .take()\n        .ok_or_else(|| anyhow::anyhow!(\"claude child stdout missing\"))?;\n    let mut stderr = child\n        .stderr\n        .take()\n        .ok_or_else(|| anyhow::anyhow!(\"claude child stderr missing\"))?;\n\n    let mut parser = StreamJsonParser::new();\n    let mut mapper = EventMapper::new();\n    let mut buf = [0u8; 8192];\n\n    // Drain stderr in parallel into a buffer for diagnostics.\n    let stderr_task = tokio::spawn(async move {\n        let mut acc = String::new();\n        let mut tmp = [0u8; 4096];\n        while let Ok(n) = stderr.read(&mut tmp).await {\n            if n == 0 {\n                break;\n            }\n            acc.push_str(&String::from_utf8_lossy(&tmp[..n]));\n            if acc.len() > 16_384 {\n                acc.truncate(16_384);\n            }\n        }","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/inference/provider/claude_code/driver.rs#L392-L428","documentation":"Taking the piped stderr handle from the spawned claude child returned None. Same guard shape as the stdout one: stderr was requested piped, so None means the configuration was lost or the handle already consumed — an invariant failure rather than an IO error.","triggerScenarios":"Thrown at src/openhuman/inference/provider/claude_code/driver.rs:410 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure stderr is configured as Stdio::piped when spawning","Audit for any code taking the handle before the driver"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}