tinyhumansai/openhuman · error

checked Some above

Error message

checked Some above

What it means

Internal invariant assertion in the Claude Code driver's run_turn: the code takes an Option, checks the Some case earlier in the function, and this expect marks a branch that is unreachable if that check held. Firing it means the earlier None/Some reasoning was violated (e.g. a session id shape changed between check and use), i.e. a logic bug in the driver rather than bad input.

Source

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

/// Run one turn against the `claude` CLI. Awaits process exit. Forwards
/// `ProviderDelta`s through `ctx.stream` as they arrive and returns the
/// aggregated `ChatResponse` when done.
pub async fn run_turn(ctx: TurnContext<'_>) -> anyhow::Result<ChatResponse> {
    let stored = ctx.session_store.get(&ctx.thread_id);
    let is_new = !stored.as_deref().map(is_uuid_v4).unwrap_or(false);
    let cc_session_id = if is_new {
        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

View on GitHub (pinned to 7491200858)

Solutions

  1. Report with the full turn transcript — this indicates a driver logic bug, not user error
  2. Re-check is_uuid_v4 handling of stored vs generated session ids in run_turn
  3. Ensure session-store mutations between the check and use site cannot clear the value
Defensive patterns

Strategy: try-catch

When it happens

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