{"record":{"id":"a066d6c180f21f22","repo":"JuliusBrussee/caveman","slug":"label-lineno-unexpected-indent-of-indent","errorCode":null,"errorMessage":"${label}:${lineNo}: unexpected indent of ${indent} spaces","messagePattern":"(.+?):(.+?): unexpected indent of (.+?) spaces","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/generate-agent-catalog.mjs","lineNumber":106,"sourceCode":"      if (dash) {\n        if (row[blockKey] === undefined) row[blockKey] = [];\n        if (!Array.isArray(row[blockKey])) throw new Error(`${label}:${lineNo}: \"${blockKey}\" mixes map and sequence entries`);\n        row[blockKey].push(rest);\n        continue;\n      }\n      if (row[blockKey] === undefined) row[blockKey] = {};\n      if (Array.isArray(row[blockKey]) || typeof row[blockKey] !== \"object\") {\n        throw new Error(`${label}:${lineNo}: \"${blockKey}\" mixes map and sequence entries`);\n      }\n      const entry = splitKeyValue(rest, label, lineNo);\n      if (entry.value === undefined) throw new Error(`${label}:${lineNo}: nesting deeper than two levels is not supported`);\n      if (Object.prototype.hasOwnProperty.call(row[blockKey], entry.key)) {\n        throw new Error(`${label}:${lineNo}: duplicate key \"${blockKey}.${entry.key}\"`);\n      }\n      row[blockKey][entry.key] = entry.value;\n      continue;\n    }\n    throw new Error(`${label}:${lineNo}: unexpected indent of ${indent} spaces`);\n  }\n  return rows;\n}\n\nfunction splitKeyValue(text, label, lineNo) {\n  const match = /^([A-Za-z_][A-Za-z0-9_]*):(?: (.*))?$/.exec(text);\n  if (match === null) throw new Error(`${label}:${lineNo}: cannot read \"${text}\" as a \"key: value\" pair`);\n  return { key: match[1], value: match[2] === undefined ? undefined : scalar(match[2], label, lineNo) };\n}\n\nfunction scalar(text, label, lineNo) {\n  if (text === \"\") throw new Error(`${label}:${lineNo}: empty value`);\n  if (text === \"null\") return null;\n  if (text === \"true\") return true;\n  if (text === \"false\") return false;\n  if (/^-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?$/.test(text)) {\n    const value = Number(text);\n    if (!Number.isFinite(value)) throw new Error(`${label}:${lineNo}: \"${text}\" is not a finite number`);","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/scripts/generate-agent-catalog.mjs#L88-L124","documentation":"Thrown by the catalog parser when a non-empty, non-comment line's leading indent is neither 0, 2, nor 4 spaces. The parser's world model has exactly three levels (row dash line, row properties, block contents), so 1, 3, 6, 8 spaces, or any other width is structurally invalid — this includes YAML-legal odd indents and tabs expanded differently than the author assumed.","triggerScenarios":"Indenting a line with 3 spaces between levels; using 6+ spaces for what was meant as a level-2 or level-4 line; mixing tabs and spaces so the counted indent falls outside {0,2,4}; a list item nested under a list item.","commonSituations":"Editor configured for a different indent width (e.g. 4-space default) applied inconsistently; copy-paste from a differently-indented file; hand-alignment that visually matches but measures differently.","solutions":["Re-indent the line named in the error to exactly 0 (row), 2 (row property), or 4 (block content) spaces.","Configure the editor to insert spaces with a 2-space indent for this file and re-run the generator; fix each reported line as it surfaces.","Ensure no tab characters are used for indentation anywhere in the file."],"exampleFix":"# before\n- provider: anthropic\n   model: claude-4   # 3 spaces\n\n# after\n- provider: anthropic\n  model: claude-4   # 2 spaces","handlingStrategy":"validation","validationCode":"function onlyIndent024(text) {\n  return text.split(\"\\n\").every((line) => {\n    if (line.trim() === \"\" || /^ *#/.test(line)) return true;\n    const indent = /^( *)/.exec(line)[1].length;\n    return [0, 2, 4].includes(indent) && !line.startsWith(\"\\t\");\n  });\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseCatalog(text);\n} catch (err) {\n  if (/unexpected indent of \\d+ spaces/.test(err.message)) {\n    // re-indent the named line to exactly 0, 2, or 4 spaces\n  } else throw err;\n}","preventionTips":["Configure the editor: spaces only, 2-space indent, for catalog files.","Enable an editorconfig/.editor_rule banning tabs in this file."],"tags":["yaml","parser","indentation","code-generation"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}