Hmbown/CodeWhale · error

state db connection mutex poisoned

Error message

state db connection mutex poisoned

What it means

Error "state db connection mutex poisoned" thrown in Hmbown/CodeWhale.

Source

Thrown at crates/state/src/lib.rs:357

                    db_path.display()
                );
            }
        }
        Ok(())
    }

    /// Returns the filesystem path of the underlying SQLite database.
    pub fn db_path(&self) -> &Path {
        &self.db_path
    }

    fn conn(&self) -> Result<MutexGuard<'_, Connection>> {
        // Poisoning means a panic mid-operation; any open transaction was
        // rolled back when it dropped, but surface the condition rather than
        // silently continuing on a connection whose state we can't vouch for.
        self.conn
            .lock()
            .map_err(|_| anyhow::anyhow!("state db connection mutex poisoned"))
    }

    fn init_schema(conn: &Connection) -> Result<()> {
        let mut user_version: u32 = conn.query_row("PRAGMA user_version;", [], |row| row.get(0))?;
        if user_version == 0 {
            // Guard each ALTER: a database restored with a v0 header (or
            // stamped by a racing process that crashed before setting
            // user_version) can already carry these columns, and an
            // unguarded ADD COLUMN aborts the whole open with
            // "duplicate column name".
            let add_parent_entry_id = if column_exists(conn, "messages", "parent_entry_id")? {
                ""
            } else {
                "ALTER TABLE messages ADD COLUMN parent_entry_id INTEGER NULL;"
            };
            let add_current_leaf_id = if column_exists(conn, "threads", "current_leaf_id")? {
                ""
            } else {

View on GitHub (pinned to 8880682c63)

When it happens

Trigger: Thrown at crates/state/src/lib.rs:357 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/a7d7314e9109f125. Report an issue: GitHub.