{"record":{"id":"c1000843587201cd","repo":"tinyhumansai/openhuman","slug":"openhuman-threads-create-new-failed-e","errorCode":null,"errorMessage":"openhuman.threads_create_new failed: {e}","messagePattern":"openhuman\\.threads_create_new failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/tui/runner.rs","lineNumber":178,"sourceCode":"            Ok(listed) => {\n                if let Some(id) = super::cockpit::array_at(&listed, &[\"threads\", \"items\"])\n                    .first()\n                    .and_then(|thread| thread.get(\"id\").or_else(|| thread.get(\"thread_id\")))\n                    .and_then(Value::as_str)\n                {\n                    return Ok(id.to_string());\n                }\n            }\n            Err(error) => {\n                log::warn!(\"[tui] openhuman.threads_list failed: {error} — starting a new thread\")\n            }\n        }\n    }\n\n    let created = runtime\n        .invoke(\"openhuman.threads_create_new\", json!({}))\n        .await\n        .map_err(|e| anyhow::anyhow!(\"openhuman.threads_create_new failed: {e}\"))?;\n    extract_thread_id(&created).ok_or_else(|| {\n        anyhow::anyhow!(\"openhuman.threads_create_new returned no thread id: {created}\")\n    })\n}\n\n/// Pull a thread id out of a `threads.create_new` / `threads.list` response,\n/// tolerant of the `RpcOutcome` log-envelope wrapping (`{result, logs}`) and the\n/// `ApiEnvelope` data wrapping (`{data, meta}`).\npub(super) fn extract_thread_id(value: &Value) -> Option<String> {\n    // Unwrap the optional `{result, logs}` log envelope first.\n    let inner = value.get(\"result\").unwrap_or(value);\n    // Then the optional `{data, meta}` ApiEnvelope.\n    let payload = inner.get(\"data\").unwrap_or(inner);\n    payload\n        .get(\"id\")\n        .and_then(Value::as_str)\n        .map(str::to_string)\n}","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/tui/runner.rs#L160-L196","documentation":"The TUI boots the core in-process and calls openhuman.threads_create_new over RPC to get a fresh thread; this fires when that RPC itself errors (core not ready, dispatch failure) after the threads_list fallback also failed to yield an id. The TUI cannot start a session.","triggerScenarios":"Thrown at src/tui/runner.rs:178 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check core startup logs for why thread creation failed","Retry launching the TUI; verify the threads domain is registered in this build"],"exampleFix":null,"handlingStrategy":"retry","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"}