{"record":{"id":"b1d408c991f4a99e","repo":"affaan-m/ECC","slug":"cannot-adapt-antigravity-agent-label-missing-y","errorCode":null,"errorMessage":"Cannot adapt Antigravity agent ${label}: missing YAML frontmatter","messagePattern":"Cannot adapt Antigravity agent (.+?): missing YAML frontmatter","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/install/antigravity-agent.js","lineNumber":23,"sourceCode":"  Write: 'write_to_file',\n  Edit: 'replace_file_content',\n  Grep: 'grep_search',\n  Glob: 'find_by_name',\n  Bash: 'run_command',\n  WebSearch: 'search_web',\n  WebFetch: 'read_url_content',\n});\n\nconst MODEL_NAMES = Object.freeze({\n  haiku: 'flash',\n  sonnet: 'pro',\n  opus: 'pro',\n});\n\nfunction splitFrontmatter(source, label) {\n  const match = String(source || '').match(/^---\\r?\\n([\\s\\S]*?)\\r?\\n---\\r?\\n/);\n  if (!match) {\n    throw new Error(`Cannot adapt Antigravity agent ${label}: missing YAML frontmatter`);\n  }\n\n  // Keep YAML loading behind the transform boundary. Public help commands load\n  // the installer graph without executing a transform, including in hermetic\n  // packed-artifact checks where runtime dependencies are intentionally absent.\n  const frontmatter = require('js-yaml').load(match[1]);\n  if (!frontmatter || typeof frontmatter !== 'object' || Array.isArray(frontmatter)) {\n    throw new Error(`Cannot adapt Antigravity agent ${label}: frontmatter must be an object`);\n  }\n\n  return {\n    frontmatter,\n    body: source.slice(match[0].length),\n  };\n}\n\nfunction normalizeToolNames(value) {\n  const names = Array.isArray(value) ? value : String(value || '').split(',');","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/install/antigravity-agent.js#L5-L41","documentation":"splitFrontmatter adapts Claude agent files for the Antigravity target and requires the source to start with a YAML frontmatter block delimited by '---' lines (matching /^---\\r?\\n[\\s\\S]*?\\r?\\n---\\r?\\n/). If the regex does not match, the file cannot be transformed, so it throws with the file label. This keeps malformed agent sources from silently installing without metadata.","triggerScenarios":"Adapting an agent markdown file that lacks a leading '---' frontmatter block entirely; files starting with a BOM or whitespace before the first '---'; Windows files where only the opening delimiter exists; passing an empty/undefined source string (String(source || '')).","commonSituations":"A newly added agent written without frontmatter; a doc-style markdown accidentally placed in the agents directory; an editor or generator stripping frontmatter; hand-edited agent files with '--- ' (trailing space) delimiters that break the strict regex.","solutions":["Add a valid YAML frontmatter block ('---' on its own line, then YAML, then closing '---') at the top of the agent file.","Remove any BOM or leading blank lines so the file starts exactly with '---'.","Verify delimiters have no trailing spaces: lines must be exactly '---'.","If the file is not an agent, move it out of the path the Antigravity transform processes."],"exampleFix":"<!-- before: agent.md had no frontmatter -->\n<!-- after -->\n---\nname: my-agent\ndescription: Does a thing\n---\n\nAgent body markdown...","handlingStrategy":"validation","validationCode":"const hasFrontmatter = (src) => /^---\\r?\\n[\\s\\S]*?\\r?\\n---\\r?\\n/.test(String(src || ''));\nif (!hasFrontmatter(source)) throw new Error(`${label}: missing YAML frontmatter`);","typeGuard":null,"tryCatchPattern":"try {\n  const { frontmatter, body } = splitFrontmatter(source, label);\n} catch (e) {\n  if (e.message.includes('missing YAML frontmatter')) {\n    console.error(`${label}: add a '---' delimited frontmatter block at the top of the file.`);\n  }\n  throw e;\n}","preventionTips":["Lint agent markdown files for a leading '---' frontmatter block in CI.","Ensure generators/editors never prepend BOMs or blank lines to agent files.","Keep delimiters as bare '---' lines with no trailing whitespace."],"tags":["yaml","frontmatter","installer"],"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"}