{"record":{"id":"97f8849e8048cb16","repo":"affaan-m/ECC","slug":"cannot-adapt-antigravity-agent-label-frontmatt","errorCode":null,"errorMessage":"Cannot adapt Antigravity agent ${label}: frontmatter must be an object","messagePattern":"Cannot adapt Antigravity agent (.+?): frontmatter must be an object","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/install/antigravity-agent.js","lineNumber":31,"sourceCode":"\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(',');\n  return [...new Set(names\n    .map(name => String(name).trim())\n    .filter(name => Object.hasOwn(TOOL_NAMES, name))\n    .map(name => TOOL_NAMES[name]))];\n}\n\nfunction adaptAntigravityAgent(source, label = '<unknown>') {\n  const { frontmatter, body } = splitFrontmatter(source, label);","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/install/antigravity-agent.js#L13-L49","documentation":"After the frontmatter block is matched and loaded with js-yaml, splitFrontmatter requires the parsed value to be a non-null, non-array object. Frontmatter must hold key/value metadata (name, description, etc.); scalars, arrays, or null mean the agent cannot be adapted for Antigravity, so it throws. This is a shape check on the parsed YAML document.","triggerScenarios":"A frontmatter block that parses to a scalar (e.g. just 'true' or a string), a YAML list ('- item'), an empty block that loads as null, or YAML using a top-level sequence/mapping anchor that yields an array.","commonSituations":"Hand-edited frontmatter where all keys were accidentally deleted (empty '---\\n---' parses to null); frontmatter written as a YAML list; a copy/paste that replaced the key-value metadata with a single line of text.","solutions":["Rewrite the frontmatter as a YAML mapping, e.g. 'name: my-agent' plus 'description: ...'.","Ensure the block is non-empty so js-yaml does not load it as null.","Do not use a top-level YAML sequence; wrap entries under named keys.","Run js-yaml.load on the block locally to confirm it yields a plain object before installing."],"exampleFix":"// before (parses to null)\n---\n---\n// after\n---\nname: my-agent\ndescription: Agent description\n---","handlingStrategy":"type-guard","validationCode":"const yaml = require('js-yaml');\nconst m = String(source || '').match(/^---\\r?\\n([\\s\\S]*?)\\r?\\n---\\r?\\n/);\nconst fm = m && yaml.load(m[1]);\nif (!fm || typeof fm !== 'object' || Array.isArray(fm)) throw new Error(`${label}: frontmatter must be a YAML mapping`);","typeGuard":"const isFrontmatterObject = (v) => Boolean(v) && typeof v === 'object' && !Array.isArray(v);","tryCatchPattern":null,"preventionTips":["Validate that every agent's frontmatter loads as a non-empty object in a pre-install lint step.","Never leave the frontmatter block empty; include at least name and description keys.","Avoid top-level YAML sequences in agent frontmatter."],"tags":["yaml","frontmatter","type-mismatch"],"backgroundTag":"schema-validation-failed","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"}