{"record":{"id":"d52273ba3e451d9e","repo":"tinyhumansai/openhuman","slug":"claude-agent-sdk-subprocess-timed-out-while-wait","errorCode":null,"errorMessage":"[claude_agent_sdk] subprocess timed out while waiting for exit","messagePattern":"\\[claude_agent_sdk\\] subprocess timed out while waiting for exit","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/inference/provider/claude_agent_sdk/subprocess.rs","lineNumber":221,"sourceCode":"                    }\n                }\n            }\n            anyhow::Ok(())\n        })\n        .await;\n\n        match read_result {\n            Ok(inner) => inner?,\n            Err(_) => {\n                let _ = child.kill().await;\n                anyhow::bail!(\"[claude_agent_sdk] subprocess timed out while reading output\");\n            }\n        }\n\n        let status = timeout(Duration::from_secs(30), child.wait())\n            .await\n            .map_err(|_| {\n                anyhow::anyhow!(\"[claude_agent_sdk] subprocess timed out while waiting for exit\")\n            })??;\n        let stderr_output = stderr_task.await.unwrap_or_default();\n        tracing::debug!(\"[claude_agent_sdk] subprocess exited status={}\", status);\n\n        if let Some(err) = error_message {\n            anyhow::bail!(\"[claude_agent_sdk] error from claude CLI: {err}\");\n        }\n\n        // Use the final result message if present; otherwise join streaming text parts.\n        let output = result_text\n            .filter(|s| !s.is_empty())\n            .unwrap_or_else(|| text_parts.join(\"\"));\n\n        if !status.success() && output.is_empty() {\n            anyhow::bail!(\n                \"[claude_agent_sdk] claude subprocess exited with non-zero status {} and no output; stderr={}\",\n                status,\n                stderr_output","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/inference/provider/claude_agent_sdk/subprocess.rs#L203-L239","documentation":"The claude_agent_sdk subprocess did not exit within the 30-second wait timeout after output reading completed — the process is hung. The sibling read path kills the child on timeout; this site surfaces the hang as an error so the caller's turn fails fast instead of blocking the task indefinitely.","triggerScenarios":"Thrown at src/openhuman/inference/provider/claude_agent_sdk/subprocess.rs:221 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat the turn as failed and retry","Check for a stuck claude subprocess and kill it","Investigate CLI hangs (interactive prompt, blocked I/O) if recurrent"],"exampleFix":null,"handlingStrategy":"retry","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"}