{"record":{"id":"de3c6ff1117d5736","repo":"Hmbown/CodeWhale","slug":"correction-must-match-exactly-one-active-note-on-the-bounded","errorCode":null,"errorMessage":"correction must match exactly one active note on the bounded page; use Context Lens UUIDs","messagePattern":"correction must match exactly one active note on the bounded page; use Context Lens UUIDs","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/native_memory.rs","lineNumber":218,"sourceCode":"        from: &str,\n        to: &str,\n        evidence: &str,\n    ) -> Result<MemoryHit> {\n        let selected = match scope {\n            MemoryScope::Global => Self::owner_scope(),\n            MemoryScope::Workspace => Self::workspace_scope(\n                workspace_id.ok_or_else(|| anyhow!(\"workspace id required\"))?,\n            )?,\n        };\n        let access = Access::agent(vec![selected.clone()])?;\n        let mut store = self.open_structured()?;\n        let entries = store.list(&access, None, 500)?;\n        let matches: Vec<_> = entries\n            .iter()\n            .filter(|m| m.status == Status::Active && m.draft.body.trim() == from.trim())\n            .collect();\n        if matches.len() != 1 {\n            bail!(\n                \"correction must match exactly one active note on the bounded page; use Context Lens UUIDs\"\n            );\n        }\n        let old = matches[0];\n        let mut draft = Draft::note(\n            selected,\n            policy::excerpt(to, 80),\n            to,\n            Evidence {\n                kind: SourceKind::Agent,\n                uri: format!(\"codewhale:memory:{}\", old.id),\n                locator: policy::excerpt(evidence, 256),\n                sha256: None,\n                observed_at: 0,\n            },\n        );\n        draft.kind = old.draft.kind;\n        draft.key = old.draft.key.clone();","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/native_memory.rs#L200-L236","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use the note's Context Lens UUID to address it directly instead of body-text matching.","List the active notes to confirm the exact stored body text (including whitespace/case).","Check whether the note was already revised — status may no longer be Active.","If the note is older than the bounded page, use UUID addressing rather than text matching."],"exampleFix":"// before: ambiguous text match\nmemory.revise(&access, \"my old note text\", \"corrected text\")?;\n\n// after: address by UUID\nmemory.revise_by_uuid(&uuid_from_context_lens, \"corrected text\")?;","handlingStrategy":"validation","validationCode":"let active: Vec<_> = store.list(&access, None, 500)?\n    .into_iter()\n    .filter(|m| m.status == Status::Active && m.draft.body.trim() == from.trim())\n    .collect();\nif active.len() != 1 {\n    return Err(\"use the note's Context Lens UUID instead of text matching\".into());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Address notes by Context Lens UUID whenever available; reserve text matching for one-off fixes.","After revising a note, re-read its current body before revising again.","Avoid capturing duplicate notes with identical bodies.","Normalize whitespace when copying note text into a correction."],"tags":["memory","revision","ambiguity","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}