{"record":{"id":"97a12050dc7e4aab","repo":"JuliusBrussee/caveman","slug":"read-memory-s-w","errorCode":null,"errorMessage":"read memory %s: %w","messagePattern":"read memory (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mem/store.go","lineNumber":649,"sourceCode":"\t\t&supersededBy,\n\t); err != nil {\n\t\treturn err\n\t}\n\tif validUntil.Valid {\n\t\tmemory.ValidUntil = &validUntil.String\n\t}\n\tmemory.Supersedes = supersedes.String\n\tmemory.SupersededBy = supersededBy.String\n\treturn nil\n}\n\nfunc (s *Store) memoryByID(id string) (Memory, error) {\n\tvar memory Memory\n\tif err := scanMemory(s.db.QueryRow(memorySelect+` WHERE id = ?`, id), &memory); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn Memory{}, fmt.Errorf(\"memory %s not found\", id)\n\t\t}\n\t\treturn Memory{}, fmt.Errorf(\"read memory %s: %w\", id, err)\n\t}\n\treturn memory, nil\n}\n\n// migrateMemorySchema upgrades pre-supersession stores in place. SQLite cannot\n// add several columns in one statement, so each missing column is added\n// independently and legacy created_at becomes valid_from.\nfunc migrateMemorySchema(db *sql.DB) error {\n\trows, err := db.Query(`PRAGMA table_info(memories)`)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcolumns := map[string]bool{}\n\tfor rows.Next() {\n\t\tvar cid int\n\t\tvar name, kind string\n\t\tvar notNull, primaryKey int\n\t\tvar defaultValue any","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/mem/store.go#L631-L667","documentation":"memoryByID's scan of the memory row failed for a reason other than not-found (corrupt row, closed DB, etc.). The wrapped error carries the underlying SQLite scan failure.","triggerScenarios":"Thrown at mem/store.go:649 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry after transient db errors","Check db integrity if persistent","Inspect the wrapped scan error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}