tinyhumansai/openhuman · error · anyhow::Error

create scratch dir: {e}

Error message

create scratch dir: {e}

What it means

Creating the per-turn temp directory (openhuman-cc- prefix) that holds --mcp-config and other transient Claude Code state failed. A tempfile/IO failure at turn setup — nothing has been spawned yet, and best-effort cleanup semantics mean the error is about disk/tmp permissions or space.

Source

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

        let id = generate_uuid_v4();
        if let Err(e) = ctx.session_store.set(&ctx.thread_id, &id) {
            log::warn!(
                "[claude-code][driver] failed to persist session uuid for thread {}: {}",
                ctx.thread_id,
                e
            );
        }
        id
    } else {
        stored.expect("checked Some above")
    };

    // Set up a per-turn scratch dir for --mcp-config and any other transient
    // state. Best-effort cleanup at end of turn.
    let scratch = tempfile::Builder::new()
        .prefix("openhuman-cc-")
        .tempdir()
        .map_err(|e| anyhow::anyhow!("create scratch dir: {e}"))?;
    // Point CC at OpenHuman's in-process HTTP MCP server (unjailed core), so
    // the memory bridge survives CC's `.openhuman` jail deny.
    let mut mcp_config_path: Option<PathBuf> = None;
    match crate::openhuman::mcp::server::ensure_local_http().await {
        Ok(endpoint) => match write_mcp_http_config(scratch.path(), endpoint.addr, &endpoint.token) {
            Ok(p) => {
                log::debug!(
                    "[claude-code][driver] wrote http mcp-config path={} url=http://{}/ (authenticated)",
                    p.display(),
                    endpoint.addr
                );
                mcp_config_path = Some(p);
            }
            Err(e) => log::warn!(
                "[claude-code][driver] failed to write mcp-config: {e}; CC will run without OpenHuman MCP tools"
            ),
        },
        Err(e) => log::warn!(

View on GitHub (pinned to 7491200858)

Solutions

  1. Check TMPDIR writability and free space
  2. Retry the turn; transient tempfile creation failures clear
Defensive patterns

Strategy: try-catch

When it happens

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