{"record":{"id":"f89e72eb695b3f2c","repo":"tinyhumansai/openhuman","slug":"checked-some-above","errorCode":null,"errorMessage":"checked Some above","messagePattern":"checked Some above","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/inference/provider/claude_code/driver.rs","lineNumber":243,"sourceCode":"\n/// Run one turn against the `claude` CLI. Awaits process exit. Forwards\n/// `ProviderDelta`s through `ctx.stream` as they arrive and returns the\n/// aggregated `ChatResponse` when done.\npub async fn run_turn(ctx: TurnContext<'_>) -> anyhow::Result<ChatResponse> {\n    let stored = ctx.session_store.get(&ctx.thread_id);\n    let is_new = !stored.as_deref().map(is_uuid_v4).unwrap_or(false);\n    let cc_session_id = if is_new {\n        let id = generate_uuid_v4();\n        if let Err(e) = ctx.session_store.set(&ctx.thread_id, &id) {\n            log::warn!(\n                \"[claude-code][driver] failed to persist session uuid for thread {}: {}\",\n                ctx.thread_id,\n                e\n            );\n        }\n        id\n    } else {\n        stored.expect(\"checked Some above\")\n    };\n\n    // Set up a per-turn scratch dir for --mcp-config and any other transient\n    // state. Best-effort cleanup at end of turn.\n    let scratch = tempfile::Builder::new()\n        .prefix(\"openhuman-cc-\")\n        .tempdir()\n        .map_err(|e| anyhow::anyhow!(\"create scratch dir: {e}\"))?;\n    // Point CC at OpenHuman's in-process HTTP MCP server (unjailed core), so\n    // the memory bridge survives CC's `.openhuman` jail deny.\n    let mut mcp_config_path: Option<PathBuf> = None;\n    match crate::openhuman::mcp::server::ensure_local_http().await {\n        Ok(endpoint) => match write_mcp_http_config(scratch.path(), endpoint.addr, &endpoint.token) {\n            Ok(p) => {\n                log::debug!(\n                    \"[claude-code][driver] wrote http mcp-config path={} url=http://{}/ (authenticated)\",\n                    p.display(),\n                    endpoint.addr","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/inference/provider/claude_code/driver.rs#L225-L261","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/inference/provider/claude_code/driver.rs:243 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report with the full turn transcript — this indicates a driver logic bug, not user error","Re-check is_uuid_v4 handling of stored vs generated session ids in run_turn","Ensure session-store mutations between the check and use site cannot clear the value"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}