{"record":{"id":"789e3b85b1e3dccb","repo":"openai/codex","slug":"ad-hoc-note-must-not-be-empty","errorCode":null,"errorMessage":"ad-hoc note must not be empty","messagePattern":"ad-hoc note must not be empty","errorType":"validation","errorClass":"MemoriesBackendError","httpStatus":null,"severity":"error","filePath":"codex-rs/ext/memories/src/backend.rs","lineNumber":139,"sourceCode":"    File,\n    Directory,\n}\n\n#[derive(Debug, Clone, PartialEq, Eq, Serialize, JsonSchema)]\n#[schemars(deny_unknown_fields)]\npub struct MemorySearchMatch {\n    pub path: String,\n    pub match_line_number: usize,\n    pub content_start_line_number: usize,\n    pub content: String,\n    pub matched_queries: Vec<String>,\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum MemoriesBackendError {\n    #[error(\"filename '{filename}' {reason}\")]\n    InvalidFilename { filename: String, reason: String },\n    #[error(\"ad-hoc note must not be empty\")]\n    EmptyAdHocNote,\n    #[error(\"ad-hoc note '{filename}' already exists\")]\n    AdHocNoteAlreadyExists { filename: String },\n    #[error(\"path '{path}' {reason}\")]\n    InvalidPath { path: String, reason: String },\n    #[error(\"cursor '{cursor}' {reason}\")]\n    InvalidCursor { cursor: String, reason: String },\n    #[error(\"path '{path}' was not found\")]\n    NotFound { path: String },\n    #[error(\"line_offset must be a 1-indexed line number\")]\n    InvalidLineOffset,\n    #[error(\"max_lines must be a positive integer\")]\n    InvalidMaxLines,\n    #[error(\"line_offset exceeds file length\")]\n    LineOffsetExceedsFileLength,\n    #[error(\"path '{path}' is not a file\")]\n    NotFile { path: String },\n    #[error(\"queries must not be empty or contain empty strings\")]","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/ext/memories/src/backend.rs#L121-L157","documentation":"MemoriesBackend::add_ad_hoc_note rejects note bodies that are empty. Notes must carry content; a blank note is treated as a caller bug and is not stored.","triggerScenarios":"add_ad_hoc_note with an empty or whitespace-only note string.","commonSituations":"Form submitted without text; a model emitting an empty memory; input trimmed down to nothing before the call.","solutions":["Check the note is non-empty after trimming before calling add_ad_hoc_note.","Fix the upstream producer that generated empty notes.","Return a validation message to the user instead of persisting nothing."],"exampleFix":"// before\nbackend.add_ad_hoc_note(AddAdHocMemoryNoteRequest { filename, note: \"   \".into() }).await?;\n\n// after\nif note.trim().is_empty() {\n    return Err(MemoriesBackendError::EmptyAdHocNote.into());\n}\nbackend.add_ad_hoc_note(AddAdHocMemoryNoteRequest { filename, note }).await?;","handlingStrategy":"validation","validationCode":"if request.note.trim().is_empty() {\n    return Err(MemoriesBackendError::EmptyAdHocNote.into());\n}","typeGuard":"fn non_empty_note(note: &str) -> bool {\n    !note.trim().is_empty()\n}","tryCatchPattern":null,"preventionTips":["Trim and check note bodies at the UI boundary before submission.","Skip persisting empty model-generated memories.","Return a user-facing validation message instead of a backend error."],"tags":["rust","memories","validation","codex"],"backgroundTag":"empty-required-field","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}