Hmbown/CodeWhale · error

no memory note matches `{needle}`

Error message

no memory note matches `{needle}`

What it means

locate_note searched the memory journal's bullets and found none whose text equals the needle. Note that revise/retire match on exact bullet text, so a paraphrased or partially quoted note will not match even if it exists.

Source

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

}

/// Find the single bullet whose text matches `needle`, comparing on the
/// note body rather than the raw line so `- note` and indentation don't
/// have to be reproduced by the caller.
///
/// Ambiguity fails closed. If a model asks to revise a note that appears
/// twice, editing either one is a guess, and a wrong guess silently rewrites
/// durable context.
fn locate_note(body: &str, needle: &str) -> Result<usize> {
    let matches: Vec<usize> = body
        .lines()
        .enumerate()
        .filter(|(_, line)| bullet_text(line).is_some_and(|text| text == needle))
        .map(|(index, _)| index)
        .collect();
    match matches.as_slice() {
        [only] => Ok(*only),
        [] => bail!("no memory note matches `{needle}`"),
        several => bail!(
            "`{needle}` matches {} notes; refusing to guess which to edit",
            several.len()
        ),
    }
}

/// The note body of a Markdown bullet, if the line is one.
fn bullet_text(line: &str) -> Option<&str> {
    let trimmed = line.trim();
    trimmed
        .strip_prefix("- ")
        .or_else(|| trimmed.strip_prefix("* "))
        .map(str::trim)
}

/// Evidence is required on every in-place edit and held to the same bounds
/// as a note. An unexplained rewrite of durable context is the thing the

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Search the journal first to get the exact bullet text
  2. Retry revise/retire with that exact text
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/tui/src/native_memory.rs:855 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/af1ff0f9aeb73e9a. Report an issue: GitHub.