{"record":{"id":"9563e745df911592","repo":"affaan-m/ECC","slug":"memory-document-sourcepath-is-missing-fields","errorCode":null,"errorMessage":"Memory document ${sourcePath} is missing fields: ${missing.join(', ')}.","messagePattern":"Memory document (.+?) is missing fields: (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/memory-vault-format.js","lineNumber":274,"sourceCode":"  const closingMarker = /\\r?\\n---(?=\\r?\\n|$)/.exec(remainder);\n  if (!closingMarker) {\n    throw new Error(`Memory document ${sourcePath} has no closing frontmatter marker.`);\n  }\n\n  const frontmatterSource = remainder.slice(0, closingMarker.index);\n  const parsed = frontmatterSource.split(/\\r?\\n/).reduce((state, line) => {\n    const next = parseFrontmatterLine(line, sourcePath, state.seen);\n    return {\n      values: { ...state.values, [next.objectKey]: next.value },\n      seen: new Set([...state.seen, next.objectKey]),\n    };\n  }, { values: {}, seen: new Set() });\n\n  const missing = FRONTMATTER_FIELDS\n    .map(([, objectKey]) => objectKey)\n    .filter(objectKey => !parsed.seen.has(objectKey));\n  if (missing.length > 0) {\n    throw new Error(`Memory document ${sourcePath} is missing fields: ${missing.join(', ')}.`);\n  }\n\n  const afterMarker = remainder.slice(closingMarker.index + closingMarker[0].length);\n  const body = afterMarker.replace(/^\\r?\\n/, '').replace(/\\r?\\n$/, '');\n  return normalizeMemory({ ...parsed.values, body });\n}\n\nfunction findPotentialSecrets(value) {\n  const text = typeof value === 'string' ? value : '';\n  return SECRET_PATTERNS\n    .filter(item => item.pattern.test(text))\n    .map(item => item.label)\n    .filter((label, index, labels) => labels.indexOf(label) === index);\n}\n\nmodule.exports = {\n  MAX_BODY_BYTES,\n  MAX_DOCUMENT_BYTES,","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/memory-vault-format.js#L256-L292","documentation":"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.","triggerScenarios":"Thrown at scripts/lib/memory-vault-format.js:274 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the missing fields named after the colon to the document's frontmatter.","Copy the frontmatter shape from an existing valid memory document.","Fix tooling that writes memory documents to always emit required fields."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}