Hmbown/CodeWhale · error

no memory note matches

Error message

no memory note matches `{needle}`

What it means

`locate_note` in the native memory store finds the bullet line whose exact text equals the given needle. When no note bullet matches exactly, it bails with this error instead of guessing. The needle is matched on normalized bullet text, so whitespace or wording differences cause misses.

Solutions

  1. List the current memory notes and copy the exact bullet text to pass as the needle.
  2. Match the note by its index instead of text if the store API allows positional edits.
  3. Create the note via `remember` if it genuinely doesn't exist.
  4. Normalize whitespace/case to match how normalize_note stores the text.

Example fix

// before: paraphrased needle
retire("user likes rust async").await?;
// after: read the store first and use the exact stored bullet
let note = store.list().await?.iter().find(|n| n.contains("rust"));
store.retire(note.trim()).await?;
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the needle exists exactly once before editing
let notes = store.list().await?;
let hits: Vec<_> = notes.iter().filter(|n| n.as_str() == needle).collect();
assert_eq!(hits.len(), 1, "needle must match exactly one note");

Prevention

When it happens

Trigger: Calling `revise` or `retire` (or the remember tool's edit paths) with a needle string that does not exactly equal any existing note's bullet text — typically because the note was reworded, trimmed, or the caller passed a paraphrase or stale text.

Common situations: An agent/human cites the note from memory instead of reading it first; the note was edited earlier so the cached text is stale; extra leading '- ' or trailing punctuation differs; case mismatch.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/af1ff0f9aeb73e9a. Report an issue: GitHub.

Appendix: 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 433685b202)