openai/codex · error · LocalStateDbStartupError

failed to initialize sqlite local db at

Error message

failed to initialize sqlite local db at {}: {detail}

What it means

Typed startup error for the TUI: opening or initializing the local sqlite state database at the given path failed (e.g. permissions, locked or corrupt file, missing directory), preventing session history and state from being loaded.

Solutions

  1. Check filesystem permissions on the database path and its parent directory
  2. Move or repair the corrupt sqlite database file
  3. Ensure the parent directory exists and CODEX_HOME points to a writable location
  4. Close other processes holding a lock on the database
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/tui/src/startup_error.rs:5 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/8c4b46ea442774fb. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/tui/src/startup_error.rs:5

use std::path::Path;
use std::path::PathBuf;

#[derive(Debug, thiserror::Error)]
#[error(
    "failed to initialize sqlite local db at {}: {detail}",
    database_path.display()
)]
pub struct LocalStateDbStartupError {
    database_path: PathBuf,
    detail: String,
}

impl LocalStateDbStartupError {
    pub fn new(database_path: PathBuf, detail: String) -> Self {
        Self {
            database_path,
            detail,
        }
    }

    pub fn database_path(&self) -> &Path {
        self.database_path.as_path()

View on GitHub (pinned to 339751715c)