Hmbown/CodeWhale · error

memory note exceeds {MAX_NOTE_BYTES} bytes

Error message

memory note exceeds {MAX_NOTE_BYTES} bytes

What it means

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.

Source

Thrown at crates/tui/src/native_memory.rs:891

/// as a note. An unexplained rewrite of durable context is the thing the
/// journal exists to prevent.
fn normalize_evidence(evidence: &str) -> Result<String> {
    normalize_note(evidence).map_err(|_| anyhow!("memory edits require non-empty evidence"))
}

fn normalize_note(note: &str) -> Result<String> {
    let note = note.replace("\r\n", "\n").replace('\r', "\n");
    let note = note
        .lines()
        .map(str::trim)
        .filter(|line| !line.is_empty())
        .collect::<Vec<_>>()
        .join(" ");
    if note.is_empty() {
        bail!("memory note is empty");
    }
    if note.len() > MAX_NOTE_BYTES {
        bail!("memory note exceeds {MAX_NOTE_BYTES} bytes");
    }
    Ok(note.trim_start_matches('-').trim().to_string())
}

fn validate_query(query: &str) -> Result<&str> {
    let query = query.trim();
    if query.is_empty() || query.chars().count() > MAX_QUERY_CHARS {
        bail!("memory search query is empty or too long");
    }
    Ok(query)
}

fn safe_component(value: &str) -> Result<String> {
    if value.is_empty()
        || value == "."
        || value == ".."
        || value.contains('/')
        || value.contains('\\')

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Split the note into smaller bullets
  2. Or trim it under the byte limit and retry
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/native_memory.rs:891 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/9e9e453489301ed7. Report an issue: GitHub.