Repository navigation
Error Reference
Ahmad Faiz Kamaludin edited this page Oct 18, 2026
·
2 revisions
All errors are sentinel values. Test them with errors.Is. Errors from deeper layers wrap these, so errors.Is keeps working through wrapped chains.
_, err := conn.Update("users").Set("active", false).Exec(ctx)
if errors.Is(err, db.ErrNoWhere) {
// forgot a WHERE clause
}Builder errors are collected while you chain and returned by the terminal call. Err() (on every builder) shows the first one early. See Core Concepts.
| Error | Returned when | Typical fix |
|---|---|---|
db.ErrNotFound |
First, Find, Sole or Value matched no row. It is sql.ErrNoRows
|
Handle "not found" explicitly |
db.ErrMultipleRecords |
Sole matched more than one row |
Add a filter, or use First
|
db.ErrNoOrder |
Chunk was called without an ORDER BY
|
Add OrderBy, or use ChunkByID
|
db.ErrNotBound |
A query ran on a DB with no connection (db.Use) |
Use db.New(conn, dialect)
|
db.ErrNoTransaction |
Transaction on a connection that cannot begin one |
Pass a *sql.DB (or a connection that supports BeginTx) |
db.ErrUnknownDialect |
The dialect value is not a known one | Use a db.Postgres, db.MySQL, db.MariaDB or db.SQLite constant |
db.ErrInvalidOperator |
An operator outside the allow-list | See allowed operators |
db.ErrInvalidDirection |
An order direction other than asc or desc
|
Fix the direction |
db.ErrNoTable |
The query has no table | Call From (or FromSub, FromRaw) |
db.ErrInvalidArgs |
Arguments the library cannot use: wrong argument count, a non-struct passed to a struct write, an unsafe index name, a missing TableName(), a malformed cursor, mismatched insert rows, ... |
Read the wrapped message for the detail |
db.ErrUnsupported |
The feature does not exist on this dialect (RETURNING on MySQL, lateral joins on SQLite, ...) |
See Dialect Differences |
db.ErrJoinNeedsOn |
A join (other than a cross join) has no ON condition |
Add the join condition |
db.ErrNoValues |
A write had nothing to write (insert with no rows, update with nothing to set, all fields omitted) | Check omitempty fields and empty inputs |
db.ErrNoWhere |
An update or delete (including Increment*) has no WHERE or LIMIT and no AllRows()
|
Add a filter, or call AllRows() on purpose |
var u User
err := conn.Select().From("users").Find(ctx, id, &u)
switch {
case err == nil:
// found
case errors.Is(err, db.ErrNotFound):
// 404
default:
// 500: log it. Driver errors can echo values, treat as sensitive
}Database driver errors (constraint violations, connection failures) are not quill sentinels. They pass through from your driver, so use the driver's own error types (for example, a unique-violation code) to detect them.
quill wiki · v0.2.0 · Repository · pkg.go.dev · Report an issue · MIT License
Basics
Building queries
Data access
- Writing Data
- Reading Data
- Pagination and Chunking
- Transactions
- Typed API
- Struct Mapping
- Hooks and Options
Reference
Guides