{"record":{"id":"59a816e7d6967991","repo":"zed-industries/zed","slug":"thread-not-found-in-database","errorCode":null,"errorMessage":"Thread not found in database","messagePattern":"Thread not found in database","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/sidebar/src/sidebar.rs","lineNumber":3847,"sourceCode":"\n        if !self.regenerating_titles.insert(thread_id) {\n            return;\n        }\n\n        let model = configured_model.model;\n        let temperature = AgentSettings::temperature_for_model(&model, cx);\n\n        let thread_store = ThreadStore::global(cx);\n        let load_task =\n            thread_store.update(cx, |store, cx| store.load_thread(session_id.clone(), cx));\n        let session_id = session_id.clone();\n\n        cx.notify();\n\n        cx.spawn(async move |this, cx| {\n            let result: anyhow::Result<SharedString> = async {\n                let Some(db_thread) = load_task.await? else {\n                    anyhow::bail!(\"Thread not found in database\");\n                };\n\n                let request = agent::build_thread_title_request(\n                    &session_id,\n                    &db_thread.messages,\n                    temperature,\n                );\n                let title =\n                    SharedString::from(agent::stream_thread_title(model, request, cx).await?);\n\n                let Some(mut db_thread) = thread_store\n                    .update(cx, |store, cx| store.load_thread(session_id.clone(), cx))\n                    .await?\n                else {\n                    anyhow::bail!(\"Thread not found in database\");\n                };\n                db_thread.title = title.clone();\n","sourceCodeStart":3829,"sourceCodeEnd":3865,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/sidebar/src/sidebar.rs#L3829-L3865","documentation":"A sentinel lookup failure during background title regeneration for an agent thread: the code spawns a task that loads the thread by session id from the thread database, and when the load yields no row (thread deleted, session id stale, or database unavailable) the Option is converted into this anyhow error inside the async block. The error is a guard for a missing record rather than a bug in title generation itself.","triggerScenarios":"Thrown at crates/sidebar/src/sidebar.rs:3847 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the session id still corresponds to an existing thread in the agent database and the thread was not deleted concurrently","If the thread store failed to open or the database is locked, resolve the underlying storage issue and retry regeneration","Treat a missing thread as benign: skip title regeneration for that session instead of propagating the error"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-09-05T10:33:00.413Z","contentChangedAt":"2026-09-05T10:33:00.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}