{"record":{"id":"132efe42ae9f14a2","repo":"BigPizzaV3/CodexPlusPlus","slug":"unsupported-local-storage-schema","errorCode":null,"errorMessage":"Unsupported local storage schema","messagePattern":"Unsupported local storage schema","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-data/src/storage.rs","lineNumber":179,"sourceCode":"                )),\n            }\n        })();\n        result.unwrap_or_else(|err| failed(&session.session_id, err.to_string()))\n    }\n\n    pub fn list_local_sessions(&self) -> anyhow::Result<Vec<LocalSession>> {\n        self.list_local_sessions_limited(usize::MAX)\n    }\n\n    pub fn list_local_sessions_limited(&self, limit: usize) -> anyhow::Result<Vec<LocalSession>> {\n        if !self.db_path.exists() {\n            return Ok(Vec::new());\n        }\n        let db = Connection::open(&self.db_path)?;\n        match schema_kind(&db)? {\n            Some(SchemaKind::CodexThreads) => self.list_codex_threads(&db, limit),\n            Some(SchemaKind::CodexAutomationRuns) => self.list_codex_automation_runs(&db, limit),\n            _ => anyhow::bail!(\"Unsupported local storage schema\"),\n        }\n    }\n\n    pub fn list_local_session_ids(&self) -> anyhow::Result<Vec<String>> {\n        if !self.db_path.exists() {\n            return Ok(Vec::new());\n        }\n        let db = Connection::open(&self.db_path)?;\n        let (table, id_column, filter) = match schema_kind(&db)? {\n            Some(SchemaKind::CodexThreads) => (\"threads\", \"id\", codex_thread_filter(&db)?),\n            Some(SchemaKind::CodexAutomationRuns) => (\n                \"automation_runs\",\n                \"thread_id\",\n                \"WHERE COALESCE(thread_id, '') <> ''\".to_string(),\n            ),\n            _ => anyhow::bail!(\"Unsupported local storage schema\"),\n        };\n        let sql = format!(\"SELECT {id_column} FROM {table} {filter} ORDER BY {id_column}\");","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-data/src/storage.rs#L161-L197","documentation":"Thrown by list_local_sessions_limited (surfaces via delete_local and list flows) when the session database exists but its schema_kind is not one the storage layer recognizes (neither CodexThreads nor the legacy shape). The offending input is the SQLite file's schema at db_path — an unknown/foreign database; the layer refuses to guess table layouts and reports the schema as unsupported.","triggerScenarios":"Thrown at crates/codex-plus-data/src/storage.rs:179 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["确认 db_path 指向的是本应用或 Codex 生成的会话数据库","检查数据库文件是否损坏（可用 sqlite3 .schema 检查表结构）","若为手工构造的测试库，按支持的 schema 建表","为新 schema 增加 schema_kind 识别与删除支持"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}