tinyhumansai/openhuman · error · anyhow::Error

close stdin: {e}

Error message

close stdin: {e}

What it means

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.

Source

Thrown at src/openhuman/inference/provider/claude_code/driver.rs:400

        .stdout(Stdio::piped())
        .stderr(Stdio::piped())
        .kill_on_drop(true);
    if let Some(key) = &ctx.anthropic_api_key {
        cmd.env("ANTHROPIC_API_KEY", key);
    }

    let mut child = cmd
        .spawn()
        .map_err(|e| anyhow::anyhow!("failed to spawn `claude`: {e}"))?;
    if let Some(mut stdin) = child.stdin.take() {
        stdin
            .write_all(&stdin_bytes)
            .await
            .map_err(|e| anyhow::anyhow!("write stdin: {e}"))?;
        stdin
            .shutdown()
            .await
            .map_err(|e| anyhow::anyhow!("close stdin: {e}"))?;
    }

    let mut stdout = child
        .stdout
        .take()
        .ok_or_else(|| anyhow::anyhow!("claude child stdout missing"))?;
    let mut stderr = child
        .stderr
        .take()
        .ok_or_else(|| anyhow::anyhow!("claude child stderr missing"))?;

    let mut parser = StreamJsonParser::new();
    let mut mapper = EventMapper::new();
    let mut buf = [0u8; 8192];

    // Drain stderr in parallel into a buffer for diagnostics.
    let stderr_task = tokio::spawn(async move {
        let mut acc = String::new();

View on GitHub (pinned to 7491200858)

Solutions

  1. Check whether the claude process exited prematurely
  2. Retry the turn
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/openhuman/inference/provider/claude_code/driver.rs:400 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/76d161afa7b88c2e. Report an issue: GitHub.