affaan-m/ECC · error · Error

Memory was not found.

Error message

Memory ${memoryId} was not found.

What it means

When resolving a single memory by id (the lookup flow that also computes backlinks), the library filters loaded entries by id and target harness. If no entry survives the filter, it throws this error — the memory either does not exist or exists only for other harnesses.

Solutions

  1. Verify the memory id (list memories / inspect vault files <kind>s/<id>.md).
  2. Re-run the lookup with a different/omitted target harness filter if the memory may be scoped to another harness.
  3. Recreate the memory with saveMemory if it was deleted.
  4. Confirm you are pointing at the correct vault root/rocks configuration.

Example fix

// before
lookupMemory('deploy-note', { targetHarness: 'codex' }); // memory saved for claude only
// after
const all = searchMemories('deploy');
lookupMemory('deploy-note'); // omit harness filter or pick a matching harness
Defensive patterns

Strategy: try-catch

Validate before calling

const exists = (await searchMemories(memoryId)).some(m => m.id === memoryId);
if (!exists) throw new Error(`Memory ${memoryId} not present in this vault; list memories first.`);

Try / catch

try {
  const memory = lookupMemory(memoryId, { targetHarness });
} catch (err) {
  if (err.message.includes('was not found')) {
    // fall back: search by keyword, or retry without the harness filter
  } else throw err;
}

Prevention

When it happens

Trigger: Requesting a memory by an id that is not in the vault, or requesting one whose targetHarnesses list includes neither 'all' nor the harness you passed as the target-harness filter.

Common situations: Typo in the memory id; memory was deleted or renamed; the memory was saved scoped to a different harness (e.g. claude-only) while querying as codex; the vault root being searched is not the one where it was saved.

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 affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/8fb3b186b5ccc6a9. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/memory-vault.js:685

function readMemoryById(id, options = {}) {
  const memoryId = validateMemoryId(id);
  const targetHarness = options.targetHarness
    ? validateSlug(options.targetHarness, 'target harness')
    : null;
  const loaded = readMemoryFiles(options);
  if (loaded.truncated || loaded.invalidFileCount > 0) {
    throw incompleteMemoryLookupError();
  }
  const matches = loaded.entries
    .filter(entry => entry.memory.id === memoryId)
    .filter(entry => (
      !targetHarness
      || entry.memory.targetHarnesses.includes('all')
      || entry.memory.targetHarnesses.includes(targetHarness)
    ));
  if (matches.length === 0) {
    throw new Error(`Memory ${memoryId} was not found.`);
  }
  if (matches.length > 1) {
    throw new Error(`Memory ${memoryId} is duplicated in ${matches.length} files.`);
  }
  const allBacklinks = loaded.entries
    .filter(entry => entry.memory.links.includes(memoryId))
    .filter(entry => entry.memory.status === 'active')
    .map(entry => entry.memory)
    .filter(memory => (
      !targetHarness
      || memory.targetHarnesses.includes('all')
      || memory.targetHarnesses.includes(targetHarness)
    ))
    .sort((left, right) => left.id.localeCompare(right.id));
  const backlinks = allBacklinks
    .slice(0, MAX_RESULTS)
    .map(summarizeMemory);
  return {

View on GitHub (pinned to 8321021c54)