{"record":{"id":"feb7ba175e4df570","repo":"affaan-m/ECC","slug":"message","errorCode":null,"errorMessage":"message","messagePattern":"message","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"docker/plugin-setup/prepare-packed-cli.js","lineNumber":20,"sourceCode":"\n'use strict';\n\nconst { spawnSync } = require('child_process');\nconst fs = require('fs');\nconst path = require('path');\n\nconst EXPECTED_NAME = 'ecc-universal';\nconst EXPECTED_BIN = 'scripts/ecc.js';\nconst CHILD_PROCESS_TIMEOUT_MS = 5 * 60 * 1000;\nconst REQUIRED_FILES = Object.freeze([\n  'scripts/ecc.js',\n  'manifests/install-components.json',\n  'manifests/install-modules.json',\n  'manifests/install-profiles.json',\n]);\n\nfunction fail(message) {\n  throw new Error(message);\n}\n\nfunction isWithin(root, candidate) {\n  const relative = path.relative(root, candidate);\n  return relative === '' || (\n    relative !== '..'\n    && !relative.startsWith(`..${path.sep}`)\n    && !path.isAbsolute(relative)\n  );\n}\n\nfunction requireRegularFile(packageRoot, relativePath) {\n  const resolvedPath = path.resolve(packageRoot, relativePath);\n  if (!isWithin(packageRoot, resolvedPath)) {\n    fail(`Package path escapes the extracted root: ${relativePath}`);\n  }\n  let file;\n  try {","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/docker/plugin-setup/prepare-packed-cli.js#L2-L38","documentation":"parseMemoryDocument parses a memory-vault document's YAML-ish frontmatter, which must be delimited by an opening and a closing '---' marker. After locating the opening marker, it searches the remainder of the source with the regex /\\r?\\n---(?=\\r?\\n|$)/; if no closing marker line exists anywhere, it throws this error. The library throws it to avoid silently treating the entire document (including intended body text) as unterminated frontmatter.","triggerScenarios":"Calling parseMemoryDocument (directly or via memory/parsed helpers) with a source string whose frontmatter is opened with '---' but never terminated by a line containing exactly '---' followed by a newline or end-of-file. Examples: truncated file, missing final newline with trailing content not matching the lookahead, frontmatter commented out, or a closing marker indented or written as '--- ' or '----'.","commonSituations":"A memory document was hand-edited and the closing '---' deleted; a file got truncated by a failed write or interrupted sync; an editor or tool stripped trailing newlines/added trailing spaces to the marker; a user pasted only the frontmatter header into a new vault file; Windows/Unix newline mangling producing '\\r\\n---\\r' handled incorrectly after copying between OSes.","solutions":["Open the document at sourcePath and add a closing '---' line on its own line right after the last frontmatter field.","Verify the closing marker is exactly '---' with no leading whitespace, trailing characters, or extra dashes ('----' does not match).","Ensure there is a newline before the closing marker ('\\n---'); a marker glued to the last field line will not match.","Re-obtain or regenerate the corrupted document if the file was truncated (e.g. restore from git or rewrite via the library's save API)."],"exampleFix":"// before (broken memory document)\n---\ntitle: session note\nscope: project\n\n// after\n---\ntitle: session note\nscope: project\n---\nBody text goes here.","handlingStrategy":"validation","validationCode":"function hasClosingFrontmatterMarker(source) {\n  return typeof source === 'string'\n    && /^---/.test(source.trimStart())\n    && /\\r?\\n---(\\r?\\n|$)/.test(source);\n}\nif (!hasClosingFrontmatterMarker(raw)) throw new Error('Document is missing a closing --- frontmatter marker');","typeGuard":"const isDelimitedMemoryDoc = (s) => typeof s === 'string' && /^---[\\s\\S]*\\r?\\n---(\\r?\\n|$)/.test(s);","tryCatchPattern":"try {\n  const doc = parseMemoryDocument(source, sourcePath);\n} catch (err) {\n  if (err.message.includes('no closing frontmatter marker')) {\n    // surface file path + line hint to user, offer to regenerate template\n  } else throw err;\n}","preventionTips":["Always create memory documents from the library's save/template API instead of hand-writing frontmatter.","Keep the closing '---' on its own line with no indentation or trailing characters.","Lint vault files in CI with a delimiter check to catch truncated or hand-edited docs early.","Avoid editors/tools that strip trailing newlines or trailing whitespace from vault files."],"tags":["frontmatter","parse-error","memory-vault","malformed-document"],"backgroundTag":"yaml-parse-error","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"}