affaan-m/ECC · error · Error

Memory document is missing fields: .

Error message

Memory document ${sourcePath} is missing fields: ${missing.join(', ')}.

What it means

parseMemoryDocument throws when the frontmatter parsed successfully but one or more required fields (listed in the message, from the FRONTMATTER required set, e.g. title/scope) are absent. The faulting input is the frontmatter block of the document at sourcePath.

Solutions

  1. Add the missing fields named after the colon to the document's frontmatter.
  2. Copy the frontmatter shape from an existing valid memory document.
  3. Fix tooling that writes memory documents to always emit required fields.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at scripts/lib/memory-vault-format.js:274 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/9563e745df911592. Report an issue: GitHub.

Appendix: source

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

  const closingMarker = /\r?\n---(?=\r?\n|$)/.exec(remainder);
  if (!closingMarker) {
    throw new Error(`Memory document ${sourcePath} has no closing frontmatter marker.`);
  }

  const frontmatterSource = remainder.slice(0, closingMarker.index);
  const parsed = frontmatterSource.split(/\r?\n/).reduce((state, line) => {
    const next = parseFrontmatterLine(line, sourcePath, state.seen);
    return {
      values: { ...state.values, [next.objectKey]: next.value },
      seen: new Set([...state.seen, next.objectKey]),
    };
  }, { values: {}, seen: new Set() });

  const missing = FRONTMATTER_FIELDS
    .map(([, objectKey]) => objectKey)
    .filter(objectKey => !parsed.seen.has(objectKey));
  if (missing.length > 0) {
    throw new Error(`Memory document ${sourcePath} is missing fields: ${missing.join(', ')}.`);
  }

  const afterMarker = remainder.slice(closingMarker.index + closingMarker[0].length);
  const body = afterMarker.replace(/^\r?\n/, '').replace(/\r?\n$/, '');
  return normalizeMemory({ ...parsed.values, body });
}

function findPotentialSecrets(value) {
  const text = typeof value === 'string' ? value : '';
  return SECRET_PATTERNS
    .filter(item => item.pattern.test(text))
    .map(item => item.label)
    .filter((label, index, labels) => labels.indexOf(label) === index);
}

module.exports = {
  MAX_BODY_BYTES,
  MAX_DOCUMENT_BYTES,

View on GitHub (pinned to 8321021c54)