{"record":{"id":"b6b6fd8d4eb09d34","repo":"tursodatabase/turso","slug":"error-querying-database","errorCode":null,"errorMessage":"Error querying database: {}","messagePattern":"Error querying database: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/app.rs","lineNumber":1752,"sourceCode":"        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                    }\n                    Err(err) => return Err(anyhow!(err)),\n                }\n            }\n            Ok(None) => {\n                let _ = self.writeln(\"No results returned from the query.\");\n            }\n            Err(err) => {\n                return Err(anyhow::anyhow!(\"Error querying database: {}\", err));\n            }\n        }\n        Ok(())\n    }\n\n    fn display_databases(&mut self) -> anyhow::Result<()> {\n        let sql = \"PRAGMA database_list\";\n        let conn = self.conn.clone();\n        let mut databases = Vec::new();\n        self.handle_row(sql, |row| {\n            if let (\n                Ok(Value::Numeric(Numeric::Integer(seq))),\n                Ok(Value::Text(name)),\n                Ok(file_value),\n            ) = (\n                row.get::<&Value>(0),\n                row.get::<&Value>(1),\n                row.get::<&Value>(2),","sourceCodeStart":1734,"sourceCodeEnd":1770,"githubUrl":"https://github.com/tursodatabase/turso/blob/492c4a71cd7c2649e7df83da1471b74f4b1c7aa9/cli/app.rs#L1734-L1770","documentation":"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.","triggerScenarios":"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.","commonSituations":"Objects dropped concurrently by another connection; statements not yet supported by this Turso build; file I/O problems on the database or attached files.","solutions":["Run the failing SQL directly in the shell to see the full engine error","Fix the SQL or object reference named in the wrapped error","If the error says not implemented or unsupported, check Turso's supported-statement list for this version","Reopen or re-prepare if the schema changed under a long-lived connection"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match app.handle_row(sql, handler) {\n    Ok(()) => {}\n    Err(e) if e.to_string().contains(\"no such table\") => { /* skip silently */ }\n    Err(e) => return Err(anyhow!(\"query [{sql}] failed: {e}\")),\n}","preventionTips":["Run new SQL manually in the shell before wiring it into helper paths","Handle Busy and Interrupt distinctly, as handle_row already does","Include the failing SQL in wrapper error messages for faster diagnosis"],"tags":["cli","sql","query","error-wrapper","rust"],"backgroundTag":"query-execution-error","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"}