{"record":{"id":"a9b62aa98ea10db7","repo":"JuliusBrussee/caveman","slug":"repair-forgotten-successor-w","errorCode":null,"errorMessage":"repair forgotten successor: %w","messagePattern":"repair forgotten successor: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mem/store.go","lineNumber":353,"sourceCode":"\t\tif err == sql.ErrNoRows {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, fmt.Errorf(\"read forgotten memory: %w\", err)\n\t}\n\tif supersedes.Valid {\n\t\tif _, err := tx.Exec(\n\t\t\t`UPDATE memories SET superseded_by = ? WHERE id = ?`,\n\t\t\tnullableLineageID(supersededBy), supersedes.String,\n\t\t); err != nil {\n\t\t\treturn false, fmt.Errorf(\"repair forgotten predecessor: %w\", err)\n\t\t}\n\t}\n\tif supersededBy.Valid {\n\t\tif _, err := tx.Exec(\n\t\t\t`UPDATE memories SET supersedes = ? WHERE id = ?`,\n\t\t\tnullableLineageID(supersedes), supersededBy.String,\n\t\t); err != nil {\n\t\t\treturn false, fmt.Errorf(\"repair forgotten successor: %w\", err)\n\t\t}\n\t}\n\tif _, err := tx.Exec(`DELETE FROM memories WHERE id = ?`, id); err != nil {\n\t\treturn false, fmt.Errorf(\"forget: %w\", err)\n\t}\n\tif err := tx.Commit(); err != nil {\n\t\treturn false, fmt.Errorf(\"forget commit: %w\", err)\n\t}\n\treturn true, nil\n}\n\nfunc nullableLineageID(value sql.NullString) any {\n\tif value.Valid {\n\t\treturn value.String\n\t}\n\treturn nil\n}\n","sourceCodeStart":335,"sourceCodeEnd":371,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/mem/store.go#L335-L371","documentation":"The UPDATE repairing the forgotten memory's successor's supersedes pointer failed inside the Forget transaction. The wrapped error is the SQLite failure; rollback keeps lineage intact.","triggerScenarios":"Thrown at mem/store.go:353 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the forget","Check db locks/writability"],"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-14T05:17:10.506Z"}