{"record":{"id":"27e7a284c5167909","repo":"tursodatabase/turso","slug":"error-in-database-list","errorCode":null,"errorMessage":"Error in database list: {}","messagePattern":"Error in database list: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/app.rs","lineNumber":1726,"sourceCode":"            ));\n        } else {\n            let _ = self.writeln(b\"No tables found in the database.\");\n        }\n        Ok(())\n    }\n\n    fn database_names(&mut self) -> anyhow::Result<Vec<String>> {\n        let sql = \"PRAGMA database_list\";\n        let mut db_names: Vec<String> = Vec::new();\n        let handler = |row: &turso_core::Row| {\n            if let Ok(Value::Text(name)) = row.get::<&Value>(1) {\n                db_names.push(name.to_string());\n            }\n            Ok(())\n        };\n        match self.handle_row(sql, handler) {\n            Ok(_) => Ok(db_names),\n            Err(e) => Err(anyhow::anyhow!(\"Error in database list: {}\", e)),\n        }\n    }\n\n    fn handle_row<F>(&mut self, sql: &str, handler: F) -> anyhow::Result<()>\n    where\n        F: FnMut(&turso_core::Row) -> turso_core::Result<()>,\n    {\n        match self.conn.query(sql) {\n            Ok(Some(ref mut rows)) => {\n                let res = rows.run_with_row_callback(handler);\n                match res {\n                    Ok(_) => {}\n                    Err(LimboError::Busy) => {\n                        let _ = self.writeln(\"database is busy\");\n                    }\n                    Err(LimboError::Interrupt) => {\n                        let _ = self.writeln(LimboError::Interrupt.to_string());\n                    }","sourceCodeStart":1708,"sourceCodeEnd":1744,"githubUrl":"https://github.com/tursodatabase/turso/blob/492c4a71cd7c2649e7df83da1471b74f4b1c7aa9/cli/app.rs#L1708-L1744","documentation":"Wrapper thrown by database_names() when PRAGMA database_list fails while collecting the names of the main and attached databases (cli/app.rs:1716). The underlying error is chained, so the message shows the real cause - busy connection, unreadable file, or corrupt header.","triggerScenarios":"Calling .databases or any completion path that uses database_names() while the connection is busy or interrupted, the main database file becomes unreadable, or an attached database vanishes or is corrupted mid-session.","commonSituations":"Attached files on removable or network storage that unmounted; permission changes while the shell is open; issuing .databases immediately after a Ctrl-C interrupt leaves statement state inconsistent.","solutions":["Read the chained error text - it names the underlying LimboError","Resolve the cause: reattach the missing database, restore read permission, or reopen the file","Run PRAGMA database_list manually to reproduce","Reopen the connection if it is in a bad state after an interrupt"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let dbs = match app.database_names() {\n    Ok(names) => names,\n    Err(e) if e.to_string().contains(\"busy\") => {\n        std::thread::sleep(std::time::Duration::from_millis(100));\n        app.database_names()?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Retry on transient busy errors from PRAGMA database_list","Keep attached database files on stable storage","Read the chained error to find the real cause before guessing"],"tags":["cli","pragma","database-list","metadata","rust"],"backgroundTag":"metadata-query-failed","analyzedSha":"492c4a71cd7c2649e7df83da1471b74f4b1c7aa9","analyzedAt":"2026-08-20T07:02:18.389Z","contentChangedAt":"2026-08-20T07:02:18.389Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}