{"record":{"id":"ca3fa546e23a42c1","repo":"cayleygraph/cayley","slug":"error-executing-value-lookup-w","errorCode":null,"errorMessage":"error executing value lookup: %w","messagePattern":"error executing value lookup: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"graph/sql/quadstore.go","lineNumber":693,"sourceCode":"\t} else {\n\t\tvtimeScan = &vtimeStd\n\t\tvtimeTime = &vtimeStd.Time\n\t\tvtimeValid = &vtimeStd.Valid\n\t}\n\tif err := c.Scan(\n\t\t&data,\n\t\t&str,\n\t\t&typ,\n\t\t&lang,\n\t\t&iri,\n\t\t&bnode,\n\t\t&vint,\n\t\t&vbool,\n\t\t&vfloat,\n\t\tvtimeScan,\n\t); err != nil {\n\t\tif err != sql.ErrNoRows {\n\t\t\treturn nil, fmt.Errorf(\"error executing value lookup: %w\", err)\n\t\t}\n\t}\n\tvar val quad.Value\n\tif str.Valid {\n\t\tif iri.Bool {\n\t\t\tval = quad.IRI(str.String)\n\t\t} else if bnode.Bool {\n\t\t\tval = quad.BNode(str.String)\n\t\t} else if lang.Valid {\n\t\t\tval = quad.LangString{\n\t\t\t\tValue: quad.String(unescapeNullByte(str.String)),\n\t\t\t\tLang:  lang.String,\n\t\t\t}\n\t\t} else if typ.Valid {\n\t\t\tval = quad.TypedString{\n\t\t\t\tValue: quad.String(unescapeNullByte(str.String)),\n\t\t\t\tType:  quad.IRI(typ.String),\n\t\t\t}","sourceCodeStart":675,"sourceCodeEnd":711,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/graph/sql/quadstore.go#L675-L711","documentation":"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.","triggerScenarios":"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.","commonSituations":"Schema version mismatch after upgrading Cayley without running migration; dropped/renamed values table; transient network errors between app and database.","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"],"exampleFix":"// before\nval, err := qs.NameOf(h) // opaque failure\n// after\nval, err := qs.NameOf(h)\nif err != nil { log.Printf(\"cause: %v\", errors.Unwrap(err)) }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"val, err := qs.NameOf(h)\nvar cause error\nfor e := err; e != nil; e = errors.Unwrap(e) { cause = e }\nif err != nil && cause != sql.ErrNoRows {\n    // log cause; check DB connectivity/schema before retrying\n}","preventionTips":["Monitor DB connection health before heavy lookups","Run schema migrations whenever upgrading the library","Wrap NameOf results with context about which hash failed"],"tags":["database","sql","query"],"backgroundTag":"database-query-failed","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}