affaan-m/ECC · error
Cannot adapt Antigravity agent
Error message
Cannot adapt Antigravity agent ${label}: missing YAML frontmatter What it means
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.
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.
Example fix
<!-- before: agent.md had no frontmatter --> <!-- after --> --- name: my-agent description: Does a thing --- Agent body markdown...
Defensive patterns
Strategy: validation
Validate before calling
const hasFrontmatter = (src) => /^---\r?\n[\s\S]*?\r?\n---\r?\n/.test(String(src || ''));
if (!hasFrontmatter(source)) throw new Error(`${label}: missing YAML frontmatter`); Try / catch
try {
const { frontmatter, body } = splitFrontmatter(source, label);
} catch (e) {
if (e.message.includes('missing YAML frontmatter')) {
console.error(`${label}: add a '---' delimited frontmatter block at the top of the file.`);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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 || '')).
Common situations: 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.
Related errors
- Cannot adapt Antigravity agent
- WARN
- Another ECC process is updating Claude settings
- At least one guided harness must be selected
- ${blockingIssues.map(issue => issue.message).join('; ')}
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/b1d408c991f4a99e.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/install/antigravity-agent.js:23
Write: 'write_to_file',
Edit: 'replace_file_content',
Grep: 'grep_search',
Glob: 'find_by_name',
Bash: 'run_command',
WebSearch: 'search_web',
WebFetch: 'read_url_content',
});
const MODEL_NAMES = Object.freeze({
haiku: 'flash',
sonnet: 'pro',
opus: 'pro',
});
function splitFrontmatter(source, label) {
const match = String(source || '').match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n/);
if (!match) {
throw new Error(`Cannot adapt Antigravity agent ${label}: missing YAML frontmatter`);
}
// Keep YAML loading behind the transform boundary. Public help commands load
// the installer graph without executing a transform, including in hermetic
// packed-artifact checks where runtime dependencies are intentionally absent.
const frontmatter = require('js-yaml').load(match[1]);
if (!frontmatter || typeof frontmatter !== 'object' || Array.isArray(frontmatter)) {
throw new Error(`Cannot adapt Antigravity agent ${label}: frontmatter must be an object`);
}
return {
frontmatter,
body: source.slice(match[0].length),
};
}
function normalizeToolNames(value) {
const names = Array.isArray(value) ? value : String(value || '').split(',');View on GitHub (pinned to 8321021c54)