affaan-m/ECC · error · Error
Unknown memory frontmatter field in
Error message
Unknown memory frontmatter field in ${sourcePath}. What it means
parseFrontmatterLine() looks up the serialized key (the text before the colon) in the FRONTMATTER_KEYS map. Only whitelisted field names are accepted; any other key — even a well-formed `key: value` line — is rejected to keep the document schema strict and catch typos.
Solutions
- Replace the key with one of the supported frontmatter field names (schema, id, title, targetHarnesses, etc. — the keys FRONTMATTER_KEYS recognizes).
- Fix casing/typos so the serialized key matches exactly (lookup is exact, not case-insensitive).
- Move unsupported metadata into the document body below the closing --- instead of frontmatter.
- Regenerate the document with the library's save path to get canonical keys.
Example fix
// before --- schema: 1 id: "notes" titel: "Deploy notes" --- // after --- schema: 1 id: "notes" title: "Deploy notes" ---
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = new Set(['schema', 'id', 'title', 'targetHarnesses']);
for (const line of frontmatterLines) {
const key = line.slice(0, line.indexOf(':')).trim();
if (!ALLOWED.has(key)) throw new Error(`Unknown frontmatter key: ${key}`);
} Type guard
const isKnownFrontmatterKey = (key) => FRONTMATTER_KEYS.has(key);
Try / catch
try {
parseMemoryDocument(source, path);
} catch (err) {
if (err.message.includes('Unknown memory frontmatter field')) {
console.error('Fix or remove the unrecognized key in %s; supported keys come from FRONTMATTER_KEYS.', path);
} else throw err;
} Prevention
- Copy frontmatter from an existing valid memory document, not from Jekyll/Hugo templates.
- Keys are matched exactly — watch casing and typos.
- Put custom metadata in the body, not frontmatter.
When it happens
Trigger: A frontmatter line with a typo'd or unsupported key such as `titel: "..."`, `tags: [...]`, `author: ...`, or a key whose canonical serialized form differs (wrong casing like `Title:`) so it misses the exact map lookup.
Common situations: Copying frontmatter from another tool (Jekyll/Hugo style keys like `layout:` or `date:`) into a memory document; renaming a key by hand after a schema change; adding custom metadata fields that the format doesn't allow.
Related errors
- Duplicate memory frontmatter field in
- Invalid memory frontmatter line in
- Memory document must start with --- frontmatter.
- Memory frontmatter field in
- -32602
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/d8f44c7f9e265091.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/memory-vault-format.js:230
}
function decodeUtf8(buffer, label = 'text') {
try {
return FATAL_UTF8_DECODER.decode(buffer);
} catch {
throw new Error(`${label} must contain valid UTF-8 text.`);
}
}
function parseFrontmatterLine(line, sourcePath, seen) {
const separator = line.indexOf(':');
if (separator <= 0) {
throw new Error(`Invalid memory frontmatter line in ${sourcePath}.`);
}
const serializedKey = line.slice(0, separator).trim();
const objectKey = FRONTMATTER_KEYS.get(serializedKey);
if (!objectKey) {
throw new Error(`Unknown memory frontmatter field in ${sourcePath}.`);
}
if (seen.has(objectKey)) {
throw new Error(`Duplicate memory frontmatter field in ${sourcePath}.`);
}
const rawValue = line.slice(separator + 1).trim();
try {
return { objectKey, value: JSON.parse(rawValue) };
} catch {
throw new Error(`Memory frontmatter field in ${sourcePath} must use a JSON value.`);
}
}
function parseMemoryDocument(source, sourcePath = '<memory>') {
const openingMarker = typeof source === 'string'
? /^---\r?\n/.exec(source)
: null;
if (!openingMarker) {
throw new Error(`Memory document ${sourcePath} must start with --- frontmatter.`);View on GitHub (pinned to 8321021c54)