JuliusBrussee/caveman · error

${corePath} exists and is not exact Caveman-owned content; r

Error message

${corePath} exists and is not exact Caveman-owned content; refusing to overwrite it

What it means

aiderNativeMutations() writes the Caveman core instructions to ~/.caveman/packs/aider/CAVEMAN.md (aiderCorePath()) and treats that file as fully Caveman-owned: it may only exist if its bytes exactly equal aiderCoreSource(). Any divergence means someone edited Caveman's managed file, so it refuses to overwrite.

Source

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

    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);
  const corePath = aiderCorePath();
  const coreBefore = fileBytes(corePath);
  const core = aiderCoreSource();
  if (coreBefore && coreBefore.toString("utf8") !== core) {
    throw new Error(`${corePath} exists and is not exact Caveman-owned content; refusing to overwrite it`);
  }
  const route = appendUrlPath(gw, "/w/aider/openai/v1");
  const native = aiderNativeConfig(configBefore?.toString("utf8") ?? "", route, corePath);
  return [
    {
      file: configPath,
      before: configBefore,
      after: Buffer.from(native.text),
      kind: "aider-config",
      owned: { route, route_block: native.routeBlock, previous_route_line: native.previousRouteLine, read_block: native.readBlock, core_path: corePath },
    },
    {
      file: corePath,
      before: coreBefore,
      after: Buffer.from(core),
      kind: "aider-core",
      owned: { marker: AIDER_NATIVE_CORE_MARKER },
    },

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. If you customized it, back it up (cp CAVEMAN.md CAVEMAN.md.custom), then delete the original
  2. Otherwise simply delete ~/.caveman/packs/aider/CAVEMAN.md so the install regenerates the current exact content
  3. Re-run the caveman aider install

Example fix

# before
$ caveman native install aider
Error: ~/.caveman/packs/aider/CAVEMAN.md exists and is not exact Caveman-owned content; refusing to overwrite it

# after
$ mv ~/.caveman/packs/aider/CAVEMAN.md ~/CAVEMAN.md.bak
$ caveman native install aider   # regenerates exact content
Defensive patterns

Strategy: validation

Validate before calling

import { readFileSync } from "node:fs";
function aiderCoreExact(path: string, expected: string): boolean {
  try { return readFileSync(path, "utf8") === expected; } catch { return true; } // absent is fine
}

Try / catch

try { nativeInstallAider(); } catch (e) {
  if (e instanceof Error && /not exact Caveman-owned content/.test(e.message)) {
    backUpAndDelete(corePath); nativeInstallAider();
  } else throw e;
}

Prevention

When it happens

Trigger: Native Aider install when CAVEMAN.md exists under ~/.caveman/packs/aider/ and its content differs (even by whitespace) from the version the current CLI generates — e.g. after a caveman upgrade changed NATIVE_CORE.

Common situations: User customized the core markdown; leftover file from an older caveman version whose generated content differs; partially updated installs.

Related errors


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