tinyhumansai/openhuman · error · anyhow::Error

failed to spawn `claude

Error message

failed to spawn `claude`: {e}

What it means

Spawning the `claude` CLI process failed at the OS level (command not found, permission denied, exec format error). The binary path was resolved earlier, so this is exec-time failure: the resolved path is not executable or the environment cannot launch it.

Solutions

  1. Verify the claude CLI binary exists and is executable at the resolved path
  2. Reinstall or re-link the Claude Code CLI
  3. Check the exec error kind in the wrapped error
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

        (ctx.bin_path.clone(), args.clone())
    };
    #[cfg(not(target_os = "macos"))]
    let (program, final_args): (PathBuf, Vec<String>) = (ctx.bin_path.clone(), args.clone());

    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()

View on GitHub (pinned to 7491200858)