{"record":{"id":"76d161afa7b88c2e","repo":"tinyhumansai/openhuman","slug":"close-stdin-e","errorCode":null,"errorMessage":"close stdin: {e}","messagePattern":"close stdin: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/inference/provider/claude_code/driver.rs","lineNumber":400,"sourceCode":"        .stdout(Stdio::piped())\n        .stderr(Stdio::piped())\n        .kill_on_drop(true);\n    if let Some(key) = &ctx.anthropic_api_key {\n        cmd.env(\"ANTHROPIC_API_KEY\", key);\n    }\n\n    let mut child = cmd\n        .spawn()\n        .map_err(|e| anyhow::anyhow!(\"failed to spawn `claude`: {e}\"))?;\n    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();","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/inference/provider/claude_code/driver.rs#L382-L418","documentation":"Shutting down the write half of the claude child's stdin failed after successfully writing the prompt. The child needs EOF to begin processing; a failed shutdown means the pipe is broken (child gone) and the turn cannot proceed.","triggerScenarios":"Thrown at src/openhuman/inference/provider/claude_code/driver.rs:400 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether the claude process exited prematurely","Retry the turn"],"exampleFix":null,"handlingStrategy":"try-catch","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-14T00:17:10.932Z"}