tinyhumansai/openhuman · error · anyhow::Error

write stdin: {e}

Error message

write stdin: {e}

What it means

Writing the turn prompt bytes to the spawned claude process's stdin failed — the pipe broke, typically because the child exited early. Distinct from a spawn failure: the process exists but is not accepting input.

Source

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

    let mut cmd = Command::new(&program);
    cmd.args(&final_args)
        .current_dir(&ctx.project_dir)
        .stdin(Stdio::piped())
        .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];

View on GitHub (pinned to 7491200858)

Solutions

  1. Check the child's stderr for early-exit cause
  2. Retry the turn
  3. Verify the claude CLI version accepts the invocation
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/openhuman/inference/provider/claude_code/driver.rs:396 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/94e60ca1c66d5e54. Report an issue: GitHub.