{"record":{"id":"a506007bd2058920","repo":"Yeachan-Heo/oh-my-codex","slug":"filepath-has-invalid-yaml-frontmatter-on-line","errorCode":null,"errorMessage":"${filePath} has invalid YAML frontmatter on line ${index + 2}: ${trimmed}","messagePattern":"(.+?) has invalid YAML frontmatter on line (.+?): (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/setup.ts","lineNumber":2269,"sourceCode":"\tif (!frontmatterMatch) {\n\t\tthrow new Error(\n\t\t\t`${filePath} must start with YAML frontmatter containing non-empty name and description fields`,\n\t\t);\n\t}\n\n\tlet name: string | undefined;\n\tlet description: string | undefined;\n\tconst lines = frontmatterMatch[1].split(/\\r?\\n/);\n\n\tfor (const [index, rawLine] of lines.entries()) {\n\t\tconst line = rawLine.trimEnd();\n\t\tconst trimmed = line.trim();\n\t\tif (!trimmed || trimmed.startsWith(\"#\")) continue;\n\t\tif (/^\\s/.test(rawLine)) continue;\n\n\t\tconst match = line.match(/^([A-Za-z0-9_-]+):(.*)$/);\n\t\tif (!match) {\n\t\t\tthrow new Error(\n\t\t\t\t`${filePath} has invalid YAML frontmatter on line ${index + 2}: ${trimmed}`,\n\t\t\t);\n\t\t}\n\n\t\tconst [, key, rawValue] = match;\n\t\tif (!rawValue.trim()) continue;\n\n\t\tconst parsedValue = parseSkillFrontmatterScalar(rawValue, key, filePath);\n\t\tif (key === \"name\") name = parsedValue;\n\t\tif (key === \"description\") description = parsedValue;\n\t}\n\n\tif (!name) {\n\t\tthrow new Error(`${filePath} is missing a non-empty frontmatter \"name\"`);\n\t}\n\tif (!description) {\n\t\tthrow new Error(\n\t\t\t`${filePath} is missing a non-empty frontmatter \"description\"`,","sourceCodeStart":2251,"sourceCodeEnd":2287,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/setup.ts#L2251-L2287","documentation":"Inside the frontmatter block, every non-comment, non-indented line must match 'key: value'. A line that does not match this simple single-line mapping syntax is reported with its 1-based file line number (index + 2 accounts for the opening fence and 0-based index).","triggerScenarios":"Lines like '- item' (sequences), 'nested:' followed by indented children later failing, 'key value' without a colon, or tabs/colons in odd places that break the key pattern [A-Za-z0-9_-]+:.","commonSituations":"Authors using full YAML features (lists, nested maps) that the minimal parser does not support, stray prose inside frontmatter, or duplicated malformed keys.","solutions":["Go to the reported line number in the named file and fix or remove it","Keep frontmatter to flat single-line key/value pairs only","Move complex metadata out of frontmatter into the body or code","Lint with parseSkillFrontmatter before shipping"],"exampleFix":"# before\n---\nname: my-skill\ntags:\n  - one\n  - two\ndescription: d\n---\n# after\n---\nname: my-skill\ndescription: d\ntags: one,two\n---","handlingStrategy":"validation","validationCode":"const lines = frontmatterBlock.split(/\\r?\\n/);\nfor (const [i, l] of lines.entries()) {\n  const t = l.trim();\n  if (!t || t.startsWith(\"#\") || /^\\s/.test(l)) continue;\n  if (!/^[A-Za-z0-9_-]+:(.*)$/.test(l)) throw new Error(`bad frontmatter line ${i + 2}: ${t}`);\n}","typeGuard":null,"tryCatchPattern":"try { parseSkillFrontmatter(content); } catch (e) { if (e instanceof Error && e.message.includes(\"invalid YAML frontmatter on line\")) { const ln = Number(e.message.match(/line (\\d+)/)?.[1]); fixLine(ln); } else throw e; }","preventionTips":["Use only flat key: value lines in frontmatter","No lists, nesting, or prose inside the block","Run a quick regex lint on frontmatter lines in CI"],"tags":["yaml","frontmatter","skill","parsing","line-error"],"backgroundTag":"config-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}