cayleygraph/cayley · error
error executing value lookup: %w
Error message
error executing value lookup: %w
What it means
NameOf performs a SELECT against the values table scanning string/bool/int/float/time columns to reconstruct the quad.Value. If the query fails for a reason other than ErrNoRows, it is wrapped as this error, so the underlying SQL error (connection loss, bad schema, locked table) is the cause.
Source
Thrown at graph/sql/quadstore.go:693
} else {
vtimeScan = &vtimeStd
vtimeTime = &vtimeStd.Time
vtimeValid = &vtimeStd.Valid
}
if err := c.Scan(
&data,
&str,
&typ,
&lang,
&iri,
&bnode,
&vint,
&vbool,
&vfloat,
vtimeScan,
); err != nil {
if err != sql.ErrNoRows {
return nil, fmt.Errorf("error executing value lookup: %w", err)
}
}
var val quad.Value
if str.Valid {
if iri.Bool {
val = quad.IRI(str.String)
} else if bnode.Bool {
val = quad.BNode(str.String)
} else if lang.Valid {
val = quad.LangString{
Value: quad.String(unescapeNullByte(str.String)),
Lang: lang.String,
}
} else if typ.Valid {
val = quad.TypedString{
Value: quad.String(unescapeNullByte(str.String)),
Type: quad.IRI(typ.String),
}View on GitHub (pinned to 81dcd7d73e)
Solutions
- Check the wrapped cause with errors.Unwrap / %w to see the driver error
- Verify the database schema matches the version expected by this quadstore (run migrations)
- Test DB connectivity and credentials
- Re-create or repair the values table if it is missing or corrupt
Example fix
// before
val, err := qs.NameOf(h) // opaque failure
// after
val, err := qs.NameOf(h)
if err != nil { log.Printf("cause: %v", errors.Unwrap(err)) } Defensive patterns
Strategy: try-catch
Try / catch
val, err := qs.NameOf(h)
var cause error
for e := err; e != nil; e = errors.Unwrap(e) { cause = e }
if err != nil && cause != sql.ErrNoRows {
// log cause; check DB connectivity/schema before retrying
} Prevention
- Monitor DB connection health before heavy lookups
- Run schema migrations whenever upgrading the library
- Wrap NameOf results with context about which hash failed
When it happens
Trigger: Querying the values table when the DB connection is broken, the table doesn't exist or schema was migrated manually, or a driver-level error occurs during Scan.
Common situations: Schema version mismatch after upgrading Cayley without running migration; dropped/renamed values table; transient network errors between app and database.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- sql query failed: %v query: %v
- unsupported sql database: %q
- unsupported time format: %T: %v
- unmarshal value: %w
- ErrNoBucket
AI-assisted analysis of cayleygraph/cayley@81dcd7d73e (2026-09-06).
Data as JSON: /api/errors/ca3fa546e23a42c1.
Report an issue: GitHub.