{"record":{"id":"62cfde582a544efd","repo":"Yeachan-Heo/oh-my-codex","slug":"unsupported-sandbox-md-frontmatter-line-trimmed","errorCode":null,"errorMessage":"Unsupported sandbox.md frontmatter line: ${trimmed}","messagePattern":"Unsupported sandbox\\.md frontmatter line: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/autoresearch/contracts.ts","lineNumber":111,"sourceCode":"function parseSimpleYamlFrontmatter(frontmatter: string): Record<string, unknown> {\n  const result: Record<string, unknown> = {};\n  let currentSection: string | null = null;\n\n  for (const rawLine of frontmatter.split(/\\r?\\n/)) {\n    const line = rawLine.replace(/\\t/g, '  ');\n    const trimmed = line.trim();\n    if (!trimmed || trimmed.startsWith('#')) continue;\n\n    const sectionMatch = /^([A-Za-z0-9_-]+):\\s*$/.exec(trimmed);\n    if (sectionMatch) {\n      currentSection = sectionMatch[1];\n      result[currentSection] = {};\n      continue;\n    }\n\n    const nestedMatch = /^([A-Za-z0-9_-]+):\\s*(.+)\\s*$/.exec(trimmed);\n    if (!nestedMatch) {\n      throw contractError(`Unsupported sandbox.md frontmatter line: ${trimmed}`);\n    }\n\n    const [, key, rawValue] = nestedMatch;\n    const value = rawValue.replace(/^['\"]|['\"]$/g, '');\n    if (line.startsWith(' ') || line.startsWith('\\t')) {\n      if (!currentSection) {\n        throw contractError(`Nested sandbox.md frontmatter key requires a parent section: ${trimmed}`);\n      }\n      const section = result[currentSection];\n      if (!section || typeof section !== 'object' || Array.isArray(section)) {\n        throw contractError(`Invalid sandbox.md frontmatter section: ${currentSection}`);\n      }\n      (section as Record<string, unknown>)[key] = value;\n      continue;\n    }\n\n    result[key] = value;\n    currentSection = null;","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/autoresearch/contracts.ts#L93-L129","documentation":"parseSimpleYamlFrontmatter throws when a frontmatter line is neither a section header ('key:'), a nested 'key: value' pair, nor matches the /^([A-Za-z0-9_-]+):\\s*(.+)\\s*$/ shape. The parser supports only a tiny YAML subset, so list items, comments, multiline strings, or keys with unsupported characters make the line unparseable and it throws with the offending line included.","triggerScenarios":"A sandbox.md frontmatter line like '- item', 'key: [a, b]', '# comment', 'key:', with unsupported characters in the key (spaces, dots), or a value line without a colon — anything the simple regex cannot match after failing the section/nested checks.","commonSituations":"Copying richer YAML from elsewhere (anchors, lists, quotes spanning lines) into sandbox.md; adding comments with '#'; using keys with dots or spaces expecting full YAML support.","solutions":["Rewrite the offending line as 'key: value' with an alphanumeric/underscore/hyphen key.","Remove list items, comments, and multi-line YAML constructs from sandbox.md frontmatter.","Keep nesting to exactly one level under a section header like 'evaluator:'.","Check the exact line quoted in the error message and fix or delete it."],"exampleFix":"# before (sandbox.md frontmatter)\nevaluator:\n  command: ./run.sh\n  # timeout in seconds\n  format: json\n\n# after\nevaluator:\n  command: ./run.sh\n  format: json","handlingStrategy":"validation","validationCode":"const FRONTMATTER_LINE = /^(?:[A-Za-z0-9_-]+:\\s*(?:\\S.*)?|[ \\t]+[A-Za-z0-9_-]+:\\s*.+)$/;\n\nfunction frontmatterLinesSupported(frontmatter: string): boolean {\n  return frontmatter.split(/\\r?\\n/).filter(l => l.trim()).every(l => FRONTMATTER_LINE.test(l));\n}","typeGuard":"const isSimpleYamlLine = (line: string): boolean =>\n  /^[A-Za-z0-9_-]+:(\\s+.*)?$/.test(line) || /^[ \\t]+[A-Za-z0-9_-]+:\\s+.+$/.test(line);","tryCatchPattern":"try {\n  parseSandboxContract(content);\n} catch (err) {\n  if ((err as Error).message.startsWith('Unsupported sandbox.md frontmatter line')) {\n    // the message quotes the exact offending line; simplify it to 'key: value'\n  }\n  throw err;\n}","preventionTips":["Restrict frontmatter to flat and one-level-nested key: value pairs.","No lists, comments, anchors, or multi-line strings in sandbox.md.","Use the error's quoted line to fix precisely."],"tags":["yaml","frontmatter","sandbox-md","parsing"],"backgroundTag":"unsupported-yaml-syntax","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}