tursodatabase/turso · error
Error in database list: {}
Error message
Error in database list: {} What it means
database_names() (cli/app.rs:1692) runs PRAGMA database_list to enumerate attached databases; this power's '.tables'/'.indexes' iteration over schemas. Any failure of that pragma is wrapped as 'Error in database list: {e}' and aborts the dot command.
Source
Thrown at cli/app.rs:1703
));
} else {
let _ = self.writeln(b"No tables found in the database.");
}
Ok(())
}
fn database_names(&mut self) -> anyhow::Result<Vec<String>> {
let sql = "PRAGMA database_list";
let mut db_names: Vec<String> = Vec::new();
let handler = |row: &turso_core::Row| {
if let Ok(Value::Text(name)) = row.get::<&Value>(1) {
db_names.push(name.to_string());
}
Ok(())
};
match self.handle_row(sql, handler) {
Ok(_) => Ok(db_names),
Err(e) => Err(anyhow::anyhow!("Error in database list: {}", e)),
}
}
fn handle_row<F>(&mut self, sql: &str, handler: F) -> anyhow::Result<()>
where
F: FnMut(&turso_core::Row) -> turso_core::Result<()>,
{
match self.conn.query(sql) {
Ok(Some(ref mut rows)) => {
let res = rows.run_with_row_callback(handler);
match res {
Ok(_) => {}
Err(LimboError::Busy) => {
let _ = self.writeln("database is busy");
}
Err(LimboError::Interrupt) => {
let _ = self.writeln(LimboError::Interrupt.to_string());
}View on GitHub (pinned to bad083fafb)
Solutions
- Confirm the database file still exists and is readable (ls -l, cat attempt).
- Restart the CLI and reopen the database — transient handle failures clear on reopen.
- Run PRAGMA integrity_check; once open to check file health.
- If using ATTACH'd databases, verify each path in '.databases' output still resolves.
Defensive patterns
Strategy: try-catch
Validate before calling
-- Cheap pre-flight before invoking dot commands that need the db list: PRAGMA database_list; -- fails fast with the same underlying cause
Try / catch
// Wrap '.tables'/.indexes' calls that depend on database_names and retry once
// after reopening the connection:
match shell.run(".tables") {
Err(e) if e.to_string().contains("Error in database list") => {
shell.reopen()?;
shell.run(".tables")?;
}
other => other?,
} Prevention
- Keep the underlying file present and readable for the whole CLI session.
- Reopen the connection after any external process moves or rewrites the database file.
When it happens
Trigger: PRAGMA database_list failing during a '.tables' or '.indexes' invocation: underlying I/O error (database file removed or unreadable mid-session), corrupted file header, or an internal connection error.
Common situations: The database file was deleted, moved, or its permissions changed while the CLI was still open; a file corrupted externally; flaky storage.
Related errors
- Error retrieving columns for view '{}': {}
- PRAGMA table_info returned no columns for view '{}'. The vie
- Error querying schema: {}
- Expected first argument to be a string
- Expected second argument to be an options object
AI-assisted analysis of tursodatabase/turso@bad083fafb (2026-08-16).
Data as JSON: /api/errors/27e7a284c5167909.
Report an issue: GitHub.