{"record":{"id":"946d7edec036bffb","repo":"tinyhumansai/openhuman","slug":"openhuman-threads-create-new-returned-no-thread-id","errorCode":null,"errorMessage":"openhuman.threads_create_new returned no thread id: {created}","messagePattern":"openhuman\\.threads_create_new returned no thread id: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/tui/runner.rs","lineNumber":180,"sourceCode":"                    .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}\n\n/// Resolve the OpenHuman data dir (host of `logs/`), mirroring the shell's","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/tui/runner.rs#L162-L198","documentation":"threads_create_new returned a successful RPC payload but no thread id could be extracted from it — a response-shape drift between the TUI's extractor (id/thread_id fields) and what the controller returned. The printed payload shows the actual shape.","triggerScenarios":"Thrown at src/tui/runner.rs:180 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the returned JSON in the error to see where the id lives","Fix the TUI's field extraction to match the threads controller's response schema"],"exampleFix":null,"handlingStrategy":"fallback","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-14T05:17:10.506Z"}