{"record":{"id":"8eb19b8c44133e00","repo":"affaan-m/ECC","slug":"unsupported-memory-schema","errorCode":null,"errorMessage":"Unsupported memory schema.","messagePattern":"Unsupported memory schema\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/memory-vault-format.js","lineNumber":176,"sourceCode":"  return normalized;\n}\n\nfunction normalizeMemory(memory) {\n  if (!memory || typeof memory !== 'object' || Array.isArray(memory)) {\n    throw new Error('memory must be an object.');\n  }\n\n  const targetHarnesses = uniqueStrings(memory.targetHarnesses, {\n    label: 'target harnesses',\n    limit: MAX_TARGETS,\n    validator: value => validateSlug(value, 'target harness'),\n  });\n  if (targetHarnesses.length === 0) {\n    throw new Error('target harnesses must contain at least one harness or \"all\".');\n  }\n\n  if (memory.schema !== MEMORY_SCHEMA_VERSION) {\n    throw new Error('Unsupported memory schema.');\n  }\n\n  return {\n    schema: memory.schema,\n    id: validateMemoryId(memory.id),\n    title: asNonEmptyString(memory.title, 'memory title', MAX_TITLE_CHARS),\n    kind: validateEnum(memory.kind, MEMORY_KINDS, 'memory kind'),\n    scope: validateEnum(memory.scope, MEMORY_SCOPES, 'memory scope'),\n    trust: validateEnum(memory.trust, MEMORY_TRUST_STATES, 'memory trust'),\n    status: validateEnum(memory.status, MEMORY_STATUSES, 'memory status'),\n    sourceHarness: validateSlug(memory.sourceHarness, 'source harness'),\n    targetHarnesses,\n    tags: uniqueStrings(memory.tags, {\n      label: 'tags',\n      limit: MAX_TAGS,\n      validator: value => validateSlug(value, 'tag'),\n    }),\n    links: uniqueStrings(memory.links, {","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/memory-vault-format.js#L158-L194","documentation":"Thrown by normalizeMemory() when memory.schema !== MEMORY_SCHEMA_VERSION ('ecc.memory.v1'). The schema field is the version pin for the on-disk document format; the library does no implicit migration. A mismatched value means the document was written by a different version (future or past) and the parser cannot safely interpret the surrounding fields.","triggerScenarios":"saveMemory({schema: 'ecc.memory.v2', ...}) from a future-proofing attempt. parseMemoryDocument() on a file whose schema line reads 'ecc.memory.v0'. normalizeMemory() called with a hand-built object where schema was set to a typo like 'ecc.memory.V1'. Forwarding documents from a different tool that re-uses the format.","commonSituations":"Two installed versions of ECC (one writing v1, one expecting v1 but reading a file from a beta that wrote v0). User hand-edited a memory file and 'fixed' the schema string. Migration script that bumped the schema field before updating the parser.","solutions":["Always set schema via the exported constant: const { MEMORY_SCHEMA_VERSION } = require('./scripts/lib/memory-vault-format'); then schema: MEMORY_SCHEMA_VERSION.","Use saveMemory() which sets schema: MEMORY_SCHEMA_VERSION for you in normalizeSaveInput.","For documents on disk that legitimately use an older schema, write a one-shot converter that reads them with the old library and re-saves with the current one.","Do not invent a future schema string to 'opt in' to new behaviour — there is no v2."],"exampleFix":"// before\nsaveMemory({ schema: 'ecc.memory.v2', title: 'x', body: '...' });\n\n// after\nconst { MEMORY_SCHEMA_VERSION } = require('./scripts/lib/memory-vault-format');\nsaveMemory({ schema: MEMORY_SCHEMA_VERSION, title: 'x', body: '...' });\n// or simply omit schema — saveMemory() fills it in.","handlingStrategy":"validation","validationCode":"const { MEMORY_SCHEMA_VERSION } = require('./scripts/lib/memory-vault-format');\nif (input.schema && input.schema !== MEMORY_SCHEMA_VERSION) {\n  throw new Error(`schema ${input.schema} is unsupported; expected ${MEMORY_SCHEMA_VERSION}`);\n}\nsaveMemory(input); // saveMemory fills schema automatically when omitted","typeGuard":"import { MEMORY_SCHEMA_VERSION } from './scripts/lib/memory-vault-format';\nfunction isCurrentSchema(value): value is string {\n  return value === MEMORY_SCHEMA_VERSION;\n}","tryCatchPattern":null,"preventionTips":["Import MEMORY_SCHEMA_VERSION and use it instead of hard-coding the string.","Omit schema when calling saveMemory() — normalizeSaveInput() sets it for you.","For on-disk files written by an older version, write a one-shot migrator rather than editing schema in place."],"tags":["versioning","schema","validation","memory-vault"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}