BigPizzaV3/CodexPlusPlus · error
Unsupported local storage schema
Error message
Unsupported local storage schema
What it means
list_local_sessions_limited opens the local SQLite database and dispatches on the detected schema (schema_kind). Only two layouts are supported — CodexThreads (sessions table with id/title) and CodexAutomationRuns (automation_runs) — any other or undetectable schema makes the adapter bail. This guards against querying an unrecognized database whose column assumptions would not hold.
Solutions
- Verify db_path points to the actual codex threads DB (e.g. ~/.codex/... with a sessions table having id and title columns) via sqlite3: SELECT id, title FROM sessions LIMIT 1.
- Update CodexPlusPlus to a version whose schema_kind recognizes the current codex DB layout (codex may have changed its schema).
- Fix adapter configuration (allowed_db_paths / db_path) so it doesn't target an unrelated SQLite file.
- If the DB is corrupt or foreign, restore or reinitialize it through codex.
Example fix
// before
let adapter = SQLiteStorageAdapter::new().with_db_path("./notes.db"); // arbitrary sqlite
// after
let adapter = SQLiteStorageAdapter::new()
.with_db_path(codex_home.join("state").join("threads.sqlite")); // real codex threads db Defensive patterns
Strategy: validation
Validate before calling
use rusqlite::Connection;
fn storage_is_supported(db_path: &Path) -> anyhow::Result<bool> {
let db = Connection::open(db_path)?;
Ok(schema_kind(&db)?.is_some())
}
// call before list_local_sessions Type guard
fn has_codex_schema(db_path: &Path) -> bool {
Connection::open(db_path).ok()
.and_then(|db| schema_kind(&db).ok().flatten())
.is_some()
} Try / catch
match storage.list_local_sessions_limited(50) {
Ok(sessions) => render(sessions),
Err(e) if e.to_string().contains("Unsupported local storage schema") => {
eprintln!("DB schema not recognized; update the app or fix db_path");
}
Err(e) => return Err(e),
} Prevention
- Point the adapter only at genuine codex session/automation databases
- Run `sqlite3 <db> .schema sessions` after any codex upgrade to confirm the layout still matches
- Keep CodexPlusPlus updated when codex changes its DB schema
- Check db_path existence and non-emptiness before opening
When it happens
Trigger: Calling list_local_sessions / list_local_sessions_limited when db_path points to a SQLite file whose schema matches neither CodexThreads nor CodexAutomationRuns (e.g. sessions table missing required id/title columns, unrelated SQLite file, empty schema), or when schema_kind errors/returns None.
Common situations: Pointing the storage adapter at a non-codex SQLite file via misconfigured allowed_db_paths; codex upgrading/changing its session DB layout so an older adapter no longer recognizes it; an empty or partially initialized database file created by another tool.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- 新建会话失败:app-server 未返回 thread id
- Backup source database is not an allowed local storage path
- Backup source database not found
- 本批节点描述过长或无效
- 当前平台暂不支持安装 Codex++ 入口
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/132efe42ae9f14a2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-data/src/storage.rs:241
result.message = format!("{};侧边栏索引清理失败:{error}", result.message);
}
}
result
}
pub fn list_local_sessions(&self) -> anyhow::Result<Vec<LocalSession>> {
self.list_local_sessions_limited(usize::MAX)
}
pub fn list_local_sessions_limited(&self, limit: usize) -> anyhow::Result<Vec<LocalSession>> {
if !self.db_path.exists() {
return Ok(Vec::new());
}
let db = Connection::open(&self.db_path)?;
match schema_kind(&db)? {
Some(SchemaKind::CodexThreads) => self.list_codex_threads(&db, limit),
Some(SchemaKind::CodexAutomationRuns) => self.list_codex_automation_runs(&db, limit),
_ => anyhow::bail!("Unsupported local storage schema"),
}
}
pub fn list_local_session_ids(&self) -> anyhow::Result<Vec<String>> {
if !self.db_path.exists() {
return Ok(Vec::new());
}
let db = Connection::open(&self.db_path)?;
let (table, id_column, filter) = match schema_kind(&db)? {
Some(SchemaKind::CodexThreads) => ("threads", "id", codex_thread_filter(&db)?),
Some(SchemaKind::CodexAutomationRuns) => (
"automation_runs",
"thread_id",
"WHERE COALESCE(thread_id, '') <> ''".to_string(),
),
_ => anyhow::bail!("Unsupported local storage schema"),
};
let sql = format!("SELECT {id_column} FROM {table} {filter} ORDER BY {id_column}");View on GitHub (pinned to b1ed92e5e4)