{"record":{"id":"8fb3b186b5ccc6a9","repo":"affaan-m/ECC","slug":"memory-memoryid-was-not-found","errorCode":null,"errorMessage":"Memory ${memoryId} was not found.","messagePattern":"Memory (.+?) was not found\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/memory-vault.js","lineNumber":685,"sourceCode":"\nfunction readMemoryById(id, options = {}) {\n  const memoryId = validateMemoryId(id);\n  const targetHarness = options.targetHarness\n    ? validateSlug(options.targetHarness, 'target harness')\n    : null;\n  const loaded = readMemoryFiles(options);\n  if (loaded.truncated || loaded.invalidFileCount > 0) {\n    throw incompleteMemoryLookupError();\n  }\n  const matches = loaded.entries\n    .filter(entry => entry.memory.id === memoryId)\n    .filter(entry => (\n      !targetHarness\n      || entry.memory.targetHarnesses.includes('all')\n      || entry.memory.targetHarnesses.includes(targetHarness)\n    ));\n  if (matches.length === 0) {\n    throw new Error(`Memory ${memoryId} was not found.`);\n  }\n  if (matches.length > 1) {\n    throw new Error(`Memory ${memoryId} is duplicated in ${matches.length} files.`);\n  }\n  const allBacklinks = loaded.entries\n    .filter(entry => entry.memory.links.includes(memoryId))\n    .filter(entry => entry.memory.status === 'active')\n    .map(entry => entry.memory)\n    .filter(memory => (\n      !targetHarness\n      || memory.targetHarnesses.includes('all')\n      || memory.targetHarnesses.includes(targetHarness)\n    ))\n    .sort((left, right) => left.id.localeCompare(right.id));\n  const backlinks = allBacklinks\n    .slice(0, MAX_RESULTS)\n    .map(summarizeMemory);\n  return {","sourceCodeStart":667,"sourceCodeEnd":703,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/memory-vault.js#L667-L703","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the memory id (list memories / inspect vault files <kind>s/<id>.md).","Re-run the lookup with a different/omitted target harness filter if the memory may be scoped to another harness.","Recreate the memory with saveMemory if it was deleted.","Confirm you are pointing at the correct vault root/rocks configuration."],"exampleFix":"// before\nlookupMemory('deploy-note', { targetHarness: 'codex' }); // memory saved for claude only\n// after\nconst all = searchMemories('deploy');\nlookupMemory('deploy-note'); // omit harness filter or pick a matching harness","handlingStrategy":"try-catch","validationCode":"const exists = (await searchMemories(memoryId)).some(m => m.id === memoryId);\nif (!exists) throw new Error(`Memory ${memoryId} not present in this vault; list memories first.`);","typeGuard":null,"tryCatchPattern":"try {\n  const memory = lookupMemory(memoryId, { targetHarness });\n} catch (err) {\n  if (err.message.includes('was not found')) {\n    // fall back: search by keyword, or retry without the harness filter\n  } else throw err;\n}","preventionTips":["Validate ids against a listing before direct lookups.","Be aware of harness scoping; omit targetHarness when unsure.","Don't hand-delete vault files; use library APIs so indexes stay consistent.","Use search before lookup in interactive flows."],"tags":["not-found","memory-vault","lookup"],"backgroundTag":"record-not-found","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}