JuliusBrussee/caveman · error

Aider config uses inline/scalar read; use block-list form be

Error message

Aider config uses inline/scalar read; use block-list form before enabling Caveman

What it means

aiderNativeConfig() only knows how to append items to a block-list `read:` key (i.e. `read:` on its own line with `- item` lines below). If the existing key carries an inline value (`read: file.md` or `read: [a, b]`), line-based block insertion would corrupt the YAML, so it throws and asks the user to normalize first.

Source

Thrown at packages/cli/src/index.ts:6402

  const lines = source.replace(/\r\n/g, "\n").split("\n");
  const routeIndexes = lines.flatMap((line, index) => /^openai-api-base\s*:/.test(line) ? [index] : []);
  if (routeIndexes.length > 1) throw new Error("Aider config has duplicate openai-api-base keys; refusing unsafe merge");
  const routeBlockLines = [AIDER_NATIVE_ROUTE_BEGIN, `openai-api-base: ${yamlQuote(route)}`, AIDER_NATIVE_ROUTE_END];
  const routeBlock = routeBlockLines.join(newline);
  const previousRouteLine = routeIndexes.length === 1 ? lines[routeIndexes[0]!]! : null;
  if (routeIndexes.length === 1) lines.splice(routeIndexes[0]!, 1, ...routeBlockLines);
  else {
    if (lines.some((line) => line.trim() !== "") && lines[lines.length - 1]?.trim()) lines.push("");
    lines.push(...routeBlockLines);
  }

  const readIndexes = lines.flatMap((line, index) => /^read\s*:/.test(line) ? [index] : []);
  if (readIndexes.length > 1) throw new Error("Aider config has duplicate read keys; refusing unsafe merge");
  let readBlockLines: string[];
  if (readIndexes.length === 1) {
    const readIndex = readIndexes[0]!;
    if (!/^read\s*:\s*(?:#.*)?$/.test(lines[readIndex]!)) {
      throw new Error("Aider config uses inline/scalar read; use block-list form before enabling Caveman");
    }
    let end = readIndex + 1;
    while (end < lines.length && !/^[A-Za-z0-9][A-Za-z0-9_-]*\s*:/.test(lines[end]!)) end++;
    readBlockLines = [`  ${AIDER_NATIVE_READ_BEGIN}`, `  - ${yamlQuote(corePath)}`, `  ${AIDER_NATIVE_READ_END}`];
    lines.splice(end, 0, ...readBlockLines);
  } else {
    if (lines.some((line) => line.trim() !== "") && lines[lines.length - 1]?.trim()) lines.push("");
    readBlockLines = [AIDER_NATIVE_READ_BEGIN, "read:", `  - ${yamlQuote(corePath)}`, AIDER_NATIVE_READ_END];
    lines.push(...readBlockLines);
  }
  const readBlock = readBlockLines.join(newline);
  const text = lines.join(newline).replace(/(?:\r?\n)+$/, "") + newline;
  return { text, routeBlock, previousRouteLine, readBlock };
}

function aiderNativeMutations(gw: string): NativeMutation[] {
  const configPath = join(homedir(), ".aider.conf.yml");
  const configBefore = fileBytes(configPath);

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Edit ~/.aider.conf.yml and expand the read key to block-list form
  2. Re-run the caveman aider install, which will then insert its marked entry safely

Example fix

# before
read: ./CONVENTIONS.md

# after
read:
  - ./CONVENTIONS.md
Defensive patterns

Strategy: validation

Validate before calling

import { readFileSync } from "node:fs";
function aiderReadIsBlockForm(path: string): boolean {
  try {
    const line = readFileSync(path, "utf8").split(/\r?\n/).find((l) => /^read\s*:/.test(l));
    return line === undefined || /^read\s*:\s*(#.*)?$/.test(line);
  } catch { return true; }
}

Try / catch

try { nativeInstallAider(); } catch (e) {
  if (e instanceof Error && /inline\/scalar read/.test(e.message)) {
    expandReadToBlockList(); nativeInstallAider();
  } else throw e;
}

Prevention

When it happens

Trigger: Native Aider install when ~/.aider.conf.yml contains `read: ./some.md` or `read: [a.md, b.md]` — anything not matching /^read\s*:\s*(#.*)?$/.

Common situations: Aider configs commonly use the inline single-file form; users pasting compact examples; tools generating flow-style YAML.

Related errors


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