garrytan/gstack · error · Error

SKILL.md missing frontmatter block (expected starting "---\n

Error message

SKILL.md missing frontmatter block (expected starting "---\n")

What it means

Error "SKILL.md missing frontmatter block (expected starting "---\n")" thrown in garrytan/gstack.

Source

Thrown at browse/src/browser-skills.ts:134

    const exec = process.execPath;
    if (exec && /\/browse\/dist\/browse$/.test(exec)) {
      return path.resolve(path.dirname(exec), '..', '..');
    }
  } catch {}
  // Source/dev fallback: walk up from this file's dir to a directory that has both browse/ and browser-skills/.
  // browse/src/browser-skills.ts → ../../  (the gstack root).
  return path.resolve(__dirname, '..', '..');
}

// ─── Frontmatter parsing ────────────────────────────────────────

/**
 * Parse a SKILL.md into { frontmatter, bodyMd }. Throws if the file is
 * missing required fields (host, triggers, args).
 */
export function parseSkillFile(content: string, opts: { skillName?: string } = {}): { frontmatter: SkillFrontmatter; bodyMd: string } {
  if (!content.startsWith('---\n')) {
    throw new Error('SKILL.md missing frontmatter block (expected starting "---\\n")');
  }
  const fmEnd = content.indexOf('\n---', 4);
  if (fmEnd === -1) {
    throw new Error('SKILL.md frontmatter block not terminated (expected "\\n---")');
  }
  const fmText = content.slice(4, fmEnd);
  const bodyMd = content.slice(fmEnd + 4).replace(/^\n+/, '');
  const fm = parseFrontmatterFields(fmText);

  // Validate required fields.
  const errors: string[] = [];
  const name = fm.name ?? opts.skillName ?? '';
  if (!name) errors.push('missing required field: name (or skillName hint)');
  if (!fm.host) errors.push('missing required field: host');
  // triggers and args may be omitted — empty list is valid.
  if (errors.length > 0) {
    throw new Error(`SKILL.md validation failed: ${errors.join('; ')}`);
  }

View on GitHub (pinned to 94993f7401)

When it happens

Trigger: Thrown at browse/src/browser-skills.ts:134 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of garrytan/gstack@94993f7401 (2026-08-12). Data as JSON: /api/errors/f4448f736b921584. Report an issue: GitHub.