Hmbown/CodeWhale · error

correction must match exactly one active note on the…

Error message

correction must match exactly one active note on the bounded page; use Context Lens UUIDs

What it means

native_memory revise() applies a correction by matching an existing active note by exact body text on a bounded page (last 500 entries). If the 'from' text matches zero or multiple active notes, the correction is ambiguous or missing and is refused; the message directs you to the unambiguous Context Lens UUID addressing instead.

Solutions

  1. Use the note's Context Lens UUID to address it directly instead of body-text matching.
  2. List the active notes to confirm the exact stored body text (including whitespace/case).
  3. Check whether the note was already revised — status may no longer be Active.
  4. If the note is older than the bounded page, use UUID addressing rather than text matching.

Example fix

// before: ambiguous text match
memory.revise(&access, "my old note text", "corrected text")?;

// after: address by UUID
memory.revise_by_uuid(&uuid_from_context_lens, "corrected text")?;
Defensive patterns

Strategy: validation

Validate before calling

let active: Vec<_> = store.list(&access, None, 500)?
    .into_iter()
    .filter(|m| m.status == Status::Active && m.draft.body.trim() == from.trim())
    .collect();
if active.len() != 1 {
    return Err("use the note's Context Lens UUID instead of text matching".into());
}

Prevention

When it happens

Trigger: Calling revise with a from-string that matches no active note (typo, note already revised/deleted, whitespace mismatch, note beyond the 500-entry page) or matches more than one note (duplicate bodies).

Common situations: Revising a note whose text was already edited earlier in the session; two identical notes captured twice; note older than the bounded page; trailing-whitespace or case differences between the given text and the stored body.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/de3c6ff1117d5736. Report an issue: GitHub.

Appendix: source

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

        from: &str,
        to: &str,
        evidence: &str,
    ) -> Result<MemoryHit> {
        let selected = match scope {
            MemoryScope::Global => Self::owner_scope(),
            MemoryScope::Workspace => Self::workspace_scope(
                workspace_id.ok_or_else(|| anyhow!("workspace id required"))?,
            )?,
        };
        let access = Access::agent(vec![selected.clone()])?;
        let mut store = self.open_structured()?;
        let entries = store.list(&access, None, 500)?;
        let matches: Vec<_> = entries
            .iter()
            .filter(|m| m.status == Status::Active && m.draft.body.trim() == from.trim())
            .collect();
        if matches.len() != 1 {
            bail!(
                "correction must match exactly one active note on the bounded page; use Context Lens UUIDs"
            );
        }
        let old = matches[0];
        let mut draft = Draft::note(
            selected,
            policy::excerpt(to, 80),
            to,
            Evidence {
                kind: SourceKind::Agent,
                uri: format!("codewhale:memory:{}", old.id),
                locator: policy::excerpt(evidence, 256),
                sha256: None,
                observed_at: 0,
            },
        );
        draft.kind = old.draft.kind;
        draft.key = old.draft.key.clone();

View on GitHub (pinned to 73e0f67d83)