affaan-m/ECC · error · Error

Unsupported memory schema.

Error message

Unsupported memory schema.

What it means

normalizeMemory enforces that memory.schema equals the current MEMORY_SCHEMA_VERSION constant. The memory vault format is versioned; documents written for an older (or newer, e.g. after a plugin upgrade) schema are refused rather than silently migrated or misinterpreted.

Solutions

  1. Set schema to the library's MEMORY_SCHEMA_VERSION value (import the constant rather than hardcoding).
  2. Re-save older memories through the current version's write path so they are re-serialized with the current schema.
  3. If the schema was bumped by an ECC update, migrate the document (or regenerate it) rather than editing the number blindly.
  4. Ensure the value is a number, not a string: schema: 1, not schema: "1".

Example fix

// before
const memory = { schema: "1", id: 'notes', title: 'Notes', targetHarnesses: ['all'] };

// after
import { MEMORY_SCHEMA_VERSION } from './memory-vault-format.js';
const memory = { schema: MEMORY_SCHEMA_VERSION, id: 'notes', title: 'Notes', targetHarnesses: ['all'] };
Defensive patterns

Strategy: validation

Validate before calling

import { MEMORY_SCHEMA_VERSION } from './memory-vault-format.js';
if (doc.schema !== MEMORY_SCHEMA_VERSION) {
  doc = migrateSchema(doc, doc.schema, MEMORY_SCHEMA_VERSION);
}

Type guard

const hasCurrentSchema = (m) => m.schema === MEMORY_SCHEMA_VERSION;

Try / catch

try {
  saveMemory(memory);
} catch (err) {
  if (err.message === 'Unsupported memory schema.') {
    console.error('Document schema %j != current %d; re-save or migrate it.', memory.schema, MEMORY_SCHEMA_VERSION);
  } else throw err;
}

Prevention

When it happens

Trigger: Saving or parsing a memory whose schema field is missing, set to a different number (e.g. schema: 0 or 2), a string like '1' instead of the numeric version, or copied from an older ECC version before a schema bump.

Common situations: Upgrading the ECC plugin and loading old vault documents; hand-editing frontmatter and typo-ing the schema value; copying an example with an outdated schema number; JSON.stringify serializing the number as a string via a custom writer.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — 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/8eb19b8c44133e00. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/memory-vault-format.js:176

  return normalized;
}

function normalizeMemory(memory) {
  if (!memory || typeof memory !== 'object' || Array.isArray(memory)) {
    throw new Error('memory must be an object.');
  }

  const targetHarnesses = uniqueStrings(memory.targetHarnesses, {
    label: 'target harnesses',
    limit: MAX_TARGETS,
    validator: value => validateSlug(value, 'target harness'),
  });
  if (targetHarnesses.length === 0) {
    throw new Error('target harnesses must contain at least one harness or "all".');
  }

  if (memory.schema !== MEMORY_SCHEMA_VERSION) {
    throw new Error('Unsupported memory schema.');
  }

  return {
    schema: memory.schema,
    id: validateMemoryId(memory.id),
    title: asNonEmptyString(memory.title, 'memory title', MAX_TITLE_CHARS),
    kind: validateEnum(memory.kind, MEMORY_KINDS, 'memory kind'),
    scope: validateEnum(memory.scope, MEMORY_SCOPES, 'memory scope'),
    trust: validateEnum(memory.trust, MEMORY_TRUST_STATES, 'memory trust'),
    status: validateEnum(memory.status, MEMORY_STATUSES, 'memory status'),
    sourceHarness: validateSlug(memory.sourceHarness, 'source harness'),
    targetHarnesses,
    tags: uniqueStrings(memory.tags, {
      label: 'tags',
      limit: MAX_TAGS,
      validator: value => validateSlug(value, 'tag'),
    }),
    links: uniqueStrings(memory.links, {

View on GitHub (pinned to 8321021c54)