{"record":{"id":"9e9e453489301ed7","repo":"Hmbown/CodeWhale","slug":"memory-note-exceeds-max-note-bytes-bytes","errorCode":null,"errorMessage":"memory note exceeds {MAX_NOTE_BYTES} bytes","messagePattern":"memory note exceeds (.+?) bytes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/native_memory.rs","lineNumber":891,"sourceCode":"/// as a note. An unexplained rewrite of durable context is the thing the\n/// journal exists to prevent.\nfn normalize_evidence(evidence: &str) -> Result<String> {\n    normalize_note(evidence).map_err(|_| anyhow!(\"memory edits require non-empty evidence\"))\n}\n\nfn normalize_note(note: &str) -> Result<String> {\n    let note = note.replace(\"\\r\\n\", \"\\n\").replace('\\r', \"\\n\");\n    let note = note\n        .lines()\n        .map(str::trim)\n        .filter(|line| !line.is_empty())\n        .collect::<Vec<_>>()\n        .join(\" \");\n    if note.is_empty() {\n        bail!(\"memory note is empty\");\n    }\n    if note.len() > MAX_NOTE_BYTES {\n        bail!(\"memory note exceeds {MAX_NOTE_BYTES} bytes\");\n    }\n    Ok(note.trim_start_matches('-').trim().to_string())\n}\n\nfn validate_query(query: &str) -> Result<&str> {\n    let query = query.trim();\n    if query.is_empty() || query.chars().count() > MAX_QUERY_CHARS {\n        bail!(\"memory search query is empty or too long\");\n    }\n    Ok(query)\n}\n\nfn safe_component(value: &str) -> Result<String> {\n    if value.is_empty()\n        || value == \".\"\n        || value == \"..\"\n        || value.contains('/')\n        || value.contains('\\\\')","sourceCodeStart":873,"sourceCodeEnd":909,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/native_memory.rs#L873-L909","documentation":"normalize_note enforced MAX_NOTE_BYTES on the flattened note (or evidence, which shares the bound). Oversized entries are rejected so a single remember/revise cannot blow up the context budget that the native-memory journal is designed to respect.","triggerScenarios":"Thrown at crates/tui/src/native_memory.rs:891 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Split the note into smaller bullets","Or trim it under the byte limit and retry"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}