tursodatabase/turso · error

Error querying database

Error message

Error querying database: {}

What it means

Generic wrapper from handle_row: the connection's query() call itself failed (as opposed to a per-row error) for a reason other than busy or interrupt, which are matched and handled just above it (cli/app.rs:1742). It surfaces SQL-level failures such as syntax errors, missing tables, and unsupported statements from dot-command helpers.

Solutions

  1. Run the failing SQL directly in the shell to see the full engine error
  2. Fix the SQL or object reference named in the wrapped error
  3. If the error says not implemented or unsupported, check Turso's supported-statement list for this version
  4. Reopen or re-prepare if the schema changed under a long-lived connection
Defensive patterns

Strategy: try-catch

Try / catch

match app.handle_row(sql, handler) {
    Ok(()) => {}
    Err(e) if e.to_string().contains("no such table") => { /* skip silently */ }
    Err(e) => return Err(anyhow!("query [{sql}] failed: {e}")),
}

Prevention

When it happens

Trigger: Any handle_row caller (.tables, .indexes, .databases, completion queries) issuing SQL the engine rejects: unknown table, syntax error, unsupported PRAGMA; also I/O errors while reading pages during the scan.

Common situations: Objects dropped concurrently by another connection; statements not yet supported by this Turso build; file I/O problems on the database or attached files.

Related errors


AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-08-20). Data as JSON: /api/errors/b6b6fd8d4eb09d34. Report an issue: GitHub.

Appendix: source

Thrown at cli/app.rs:1752

        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());
                    }
                    Err(err) => return Err(anyhow!(err)),
                }
            }
            Ok(None) => {
                let _ = self.writeln("No results returned from the query.");
            }
            Err(err) => {
                return Err(anyhow::anyhow!("Error querying database: {}", err));
            }
        }
        Ok(())
    }

    fn display_databases(&mut self) -> anyhow::Result<()> {
        let sql = "PRAGMA database_list";
        let conn = self.conn.clone();
        let mut databases = Vec::new();
        self.handle_row(sql, |row| {
            if let (
                Ok(Value::Numeric(Numeric::Integer(seq))),
                Ok(Value::Text(name)),
                Ok(file_value),
            ) = (
                row.get::<&Value>(0),
                row.get::<&Value>(1),
                row.get::<&Value>(2),

View on GitHub (pinned to 492c4a71cd)