You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using this new module mistakes made in providing the correct SQL for the tagstore functions often just result in an error "Failed to prepare statement" with a code of "ERR_SQLITE_ERR"
However the error thrown by sqlite itself (as picked up in the sqlite3 cli tool for instance, but other code as well) is more descriptive eg "No such column: availble" when I had misspelt a column name.
What is the feature you are proposing to solve the problem?
Make it easier to understand what the actual issue is.
This simple test program will show the difference between a prepared statement and the tag store
import{DatabaseSync}from'node:sqlite'constdb=newDatabaseSync(':memory:');constsql=db.createTagStore();//simple tabledb.exec(`CREATE TABLE IF NOT EXISTS Test (id INTEGER PRIMARY KEY, available TEXT); INSERT INTO Test(available) VALUES ('Yes'), ('No'); `);//first work with preparing and executing a statementtry{conststatement=db.prepare('SELECT avail FROM Test');constresult=statement.get();console.log('statment result',result.avail);}catch(e){console.log('error from statement get',e)}//now do the same using the tagstoretry{constresult=sql.get`SELECT avail FROM Test`;console.log('statment result',result.avail);}catch(e){console.log('error from tagstore get',e);}console.log('test complete')
Note how the prepared statement fail shows the sql that is wrong, whilst the tag store just says failed to prepare statement
I'm sure you don't need a whole repo :-)
EDITED to put a ":" at the end of ":memory" otherwise you'll find files called ":memory" on your hard drive :-(
error from statement get Error: no such column: avail
at file:///home/alan/dev/nodesqlite/test.js:10:24
at ModuleJob.run (node:internal/modules/esm/module_job:377:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:691:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
code: 'ERR_SQLITE_ERROR',
errcode: 1,
errstr: 'SQL logic error'
}
error from tagstore get Error: Failed to prepare statement
at file:///home/alan/dev/nodesqlite/test.js:18:25
at ModuleJob.run (node:internal/modules/esm/module_job:377:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:691:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
code: 'ERR_SQLITE_ERROR'
}
test complete
(node:128415) ExperimentalWarning: SQLite is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Activity
aduh95 commentedon Dec 14, 2025
Could you please provide a minimal repro and its output?
akc42 commentedon Dec 16, 2025
This simple test program will show the difference between a prepared statement and the tag store
Note how the prepared statement fail shows the sql that is wrong, whilst the tag store just says failed to prepare statement
I'm sure you don't need a whole repo :-)
EDITED to put a ":" at the end of ":memory" otherwise you'll find files called ":memory" on your hard drive :-(
akc42 commentedon Dec 16, 2025
This was the output from that program
sqlite: improve error messages for tag store
sqlite: improve error messages for tag store
sqlite: improve error messages for tag store
sqlite: improve error messages for tag store
sqlite: improve error messages for tag store
sqlite: improve error messages for tag store