{"record":{"id":"f4448f736b921584","repo":"garrytan/gstack","slug":"skill-md-missing-frontmatter-block-expected-start","errorCode":null,"errorMessage":"SKILL.md missing frontmatter block (expected starting \"---\\n\")","messagePattern":"SKILL\\.md missing frontmatter block \\(expected starting \"---\\\\n\"\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"browse/src/browser-skills.ts","lineNumber":134,"sourceCode":"    const exec = process.execPath;\n    if (exec && /\\/browse\\/dist\\/browse$/.test(exec)) {\n      return path.resolve(path.dirname(exec), '..', '..');\n    }\n  } catch {}\n  // Source/dev fallback: walk up from this file's dir to a directory that has both browse/ and browser-skills/.\n  // browse/src/browser-skills.ts → ../../  (the gstack root).\n  return path.resolve(__dirname, '..', '..');\n}\n\n// ─── Frontmatter parsing ────────────────────────────────────────\n\n/**\n * Parse a SKILL.md into { frontmatter, bodyMd }. Throws if the file is\n * missing required fields (host, triggers, args).\n */\nexport function parseSkillFile(content: string, opts: { skillName?: string } = {}): { frontmatter: SkillFrontmatter; bodyMd: string } {\n  if (!content.startsWith('---\\n')) {\n    throw new Error('SKILL.md missing frontmatter block (expected starting \"---\\\\n\")');\n  }\n  const fmEnd = content.indexOf('\\n---', 4);\n  if (fmEnd === -1) {\n    throw new Error('SKILL.md frontmatter block not terminated (expected \"\\\\n---\")');\n  }\n  const fmText = content.slice(4, fmEnd);\n  const bodyMd = content.slice(fmEnd + 4).replace(/^\\n+/, '');\n  const fm = parseFrontmatterFields(fmText);\n\n  // Validate required fields.\n  const errors: string[] = [];\n  const name = fm.name ?? opts.skillName ?? '';\n  if (!name) errors.push('missing required field: name (or skillName hint)');\n  if (!fm.host) errors.push('missing required field: host');\n  // triggers and args may be omitted — empty list is valid.\n  if (errors.length > 0) {\n    throw new Error(`SKILL.md validation failed: ${errors.join('; ')}`);\n  }","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/browser-skills.ts#L116-L152","documentation":"Error \"SKILL.md missing frontmatter block (expected starting \"---\\n\")\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/browser-skills.ts:134 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}