JuliusBrussee/caveman · error

${label}:${lineNo}: unexpected sequence item at row level

Error message

${label}:${lineNo}: unexpected sequence item at row level

What it means

Thrown by the catalog parser when a line at indent 2 (the row's property level) starts with "- ". Indent-2 lines must be "key: value" properties of the current row; sequences are only allowed one level deeper (indent 4) under an open block key. This keeps the parser's two-level model unambiguous.

Source

Thrown at scripts/generate-agent-catalog.mjs:72

    const lineNo = index + 1;
    if (line === "" || /^ *#/.test(line)) continue;
    const shape = /^( *)(- )?(.*)$/.exec(line);
    const indent = shape[1].length;
    const dash = shape[2] !== undefined;
    const rest = shape[3];
    if (indent === 0) {
      if (!dash) throw new Error(`${label}:${lineNo}: expected a top-level "- provider: ..." row`);
      row = {};
      rows.push(row);
      blockKey = null;
      const entry = splitKeyValue(rest, label, lineNo);
      if (entry.value === undefined) throw new Error(`${label}:${lineNo}: row must start with an inline "provider" value`);
      row[entry.key] = entry.value;
      continue;
    }
    if (row === null) throw new Error(`${label}:${lineNo}: indented line before any row`);
    if (indent === 2) {
      if (dash) throw new Error(`${label}:${lineNo}: unexpected sequence item at row level`);
      const entry = splitKeyValue(rest, label, lineNo);
      if (Object.prototype.hasOwnProperty.call(row, entry.key)) {
        throw new Error(`${label}:${lineNo}: duplicate key "${entry.key}"`);
      }
      if (entry.value === undefined) {
        blockKey = entry.key;
        row[entry.key] = undefined;
      } else {
        blockKey = null;
        row[entry.key] = entry.value;
      }
      continue;
    }
    if (indent === 4) {
      if (blockKey === null) throw new Error(`${label}:${lineNo}: nested line without an open block`);
      if (dash) {
        if (row[blockKey] === undefined) row[blockKey] = [];
        if (!Array.isArray(row[blockKey])) throw new Error(`${label}:${lineNo}: "${blockKey}" mixes map and sequence entries`);

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Introduce a key for the list at indent 2 and move items to indent 4: " models:" then " - claude-4".
  2. Fix indentation: any dash-item under a row property must be exactly 4 spaces in.

Example fix

# before
- provider: anthropic
  - claude-4

# after
- provider: anthropic
  models:
    - claude-4
Defensive patterns

Strategy: validation

Validate before calling

function noSequencesAtRowLevel(text) {
  return !/^ {2}- /.test(text); // any 2-space dash line is invalid
}

Try / catch

try {
  parseCatalog(text);
} catch (err) {
  if (/unexpected sequence item at row level/.test(err.message)) {
    // introduce a block key at indent 2 and move items to indent 4
  } else throw err;
}

Prevention

When it happens

Trigger: Trying to put a list directly at row level, e.g. "- provider: x" followed by " - item" instead of " key:" followed by " - item"; or re-indenting nested list items from 4 to 2 spaces.

Common situations: Hand-writing YAML following generic examples where lists sit directly under the parent; editor auto-dedent when typing nested dashes; copying a nested block but losing one level of indentation.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/6ae9c6c3b88f343e. Report an issue: GitHub.