{"record":{"id":"a7142c2c113572e9","repo":"JuliusBrussee/caveman","slug":"cannot-supersede-with-empty-text","errorCode":null,"errorMessage":"cannot supersede with empty text","messagePattern":"cannot supersede with empty text","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mem/store.go","lineNumber":206,"sourceCode":"\trow := s.db.QueryRow(memorySelect+` WHERE id = ?`, id)\n\tif err := scanMemory(row, &stored); err != nil {\n\t\treturn Memory{}, fmt.Errorf(\"read back memory: %w\", err)\n\t}\n\tif stored.ValidUntil != nil {\n\t\treturn Memory{}, fmt.Errorf(\"memory %s exists only as an expired historical version and cannot be re-remembered as current\", stored.ID)\n\t}\n\treturn stored, nil\n}\n\n// Supersede atomically replaces one current memory with a new current version.\n// The old row remains durable for history and byte-exact audit, but normal recall\n// excludes it. An already-expired or unknown id fails closed.\nfunc (s *Store) Supersede(oldID, newText string) (Memory, error) {\n\tif strings.TrimSpace(oldID) == \"\" {\n\t\treturn Memory{}, fmt.Errorf(\"supersede requires old memory id\")\n\t}\n\tif strings.TrimSpace(newText) == \"\" {\n\t\treturn Memory{}, fmt.Errorf(\"cannot supersede with empty text\")\n\t}\n\tif err := validateMemorySize(newText); err != nil {\n\t\treturn Memory{}, err\n\t}\n\ttx, err := s.db.Begin()\n\tif err != nil {\n\t\treturn Memory{}, fmt.Errorf(\"supersede begin: %w\", err)\n\t}\n\tdefer tx.Rollback()\n\n\tvar old Memory\n\tif err := scanMemory(tx.QueryRow(memorySelect+` WHERE id = ? AND valid_until IS NULL`, oldID), &old); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn Memory{}, fmt.Errorf(\"memory %s is not current\", oldID)\n\t\t}\n\t\treturn Memory{}, fmt.Errorf(\"read current memory: %w\", err)\n\t}\n\tif old.Text == newText {","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/mem/store.go#L188-L224","documentation":"Error \"cannot supersede with empty text\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at mem/store.go:206 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide non-empty replacement text for the supersede."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}