{"record":{"id":"be61d8bc3f78804f","repo":"Hmbown/CodeWhale","slug":"memory-search-query-is-empty-or-too-long","errorCode":null,"errorMessage":"memory search query is empty or too long","messagePattern":"memory search query is empty or too long","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/native_memory.rs","lineNumber":899,"sourceCode":"    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('\\\\')\n    {\n        bail!(\"invalid memory workspace id\");\n    }\n    Ok(value.to_string())\n}\n\nfn ensure_memory_file(path: &Path) -> Result<()> {\n    if let Some(parent) = path.parent() {","sourceCodeStart":881,"sourceCodeEnd":917,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/native_memory.rs#L881-L917","documentation":"validate_query guard for native-memory search: after trimming, the query is empty or exceeds MAX_QUERY_CHARS in character count. The bound keeps the search comparison cheap and blocks degenerate all-matching queries.","triggerScenarios":"Thrown at crates/tui/src/native_memory.rs:899 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a shorter, non-empty search query","Retry the memory search"],"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-14T00:17:10.932Z"}