JuliusBrussee/caveman · error · Error

Claude caveman-cloud MCP exists but is not…

Error message

Claude caveman-cloud MCP exists but is not Caveman-journaled; refusing overwrite

What it means

For Claude specifically, setup checks whether a caveman-cloud MCP registration already exists in Claude's config. If it exists but there is no Caveman journal marker proving Caveman created it, the entry may belong to the user or another tool, so the CLI refuses to overwrite it.

Solutions

  1. Restore or recreate the Caveman marker file for the claude caveman-cloud server
  2. Remove the manually-added caveman-cloud MCP entry from Claude's config and let setup install it journaled
  3. Rename your manual entry (e.g. different server name) so it does not collide
Defensive patterns

Strategy: validation

Validate before calling

const reg = claudeMcpRegistration('caveman-cloud');
const marker = readMcpServerMarker('claude', 'caveman-cloud');
if (reg.present && !marker) console.error('caveman-cloud entry exists without a Caveman marker; remove it or restore the marker before setup.');

Try / catch

try {
  runSetup('claude');
} catch (e) {
  if (String(e.message).includes('not Caveman-journaled')) {
    // delete the manual entry from Claude config (or restore the marker) and re-run
  }
}

Prevention

When it happens

Trigger: Running setup for claude when claudeMcpRegistration('caveman-cloud').present is true but readMcpServerMarker('claude','caveman-cloud') returns null (marker file missing or never written).

Common situations: User manually added a caveman-cloud MCP entry to Claude config; the marker file was deleted by a cleanup tool; upgrading from an unjournaled install method.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/528246b888948013. Report an issue: GitHub.

Appendix: source

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

  const previousSkills = new Map(existingBundle?.skills.map((skill) => [skill.file, skill]) ?? []);
  for (const { file, body } of agentNativeSkillFiles(agent)) {
    const current = fileBytes(file);
    if (!existingBundle) {
      if (current && !current.equals(Buffer.from(body))) {
        throw new Error(`${file} already exists with non-canonical content; refusing to overwrite an unjournaled skill`);
      }
      continue;
    }
    const previous = previousSkills.get(file);
    if (current && !current.equals(Buffer.from(body)) && (!previous || bytesHash(current) !== previous.after_sha256)) {
      throw new Error(`${file} changed after setup; refusing to overwrite user skill edits`);
    }
  }
  if (agent === "claude") {
    const actual = claudeMcpRegistration("caveman-cloud");
    const marker = readMcpServerMarker("claude", "caveman-cloud");
    if (actual.present && !marker) {
      throw new Error("Claude caveman-cloud MCP exists but is not Caveman-journaled; refusing overwrite");
    }
    if (actual.present && marker && !agentNativeCloudMcpMatches("claude", marker)) {
      throw new Error("Claude caveman-cloud MCP changed after setup; refusing to overwrite user fields");
    }
    return;
  }
  const config = fileBytes(join(codexHomeDir(), "config.toml"))?.toString("utf8") ?? "";
  if (!config.includes("[mcp_servers.caveman-cloud]")) return;
  if (!readMcpServerMarker("codex", "caveman-cloud")) {
    throw new Error("[mcp_servers.caveman-cloud] exists but is not Caveman-journaled; refusing overwrite");
  }
}

function installAgentNativeBundleSkills(agent: "claude" | "codex", journal: AgentNativeBundleJournal): void {
  const originals = new Map(journal.skills.map((skill) => [skill.file, skill.before_base64]));
  journal.skills = agentNativeSkillFiles(agent).map(({ file, body }) => {
    mkdirSync(dirname(file), { recursive: true });
    atomicWriteFile(file, Buffer.from(body));

View on GitHub (pinned to 3ee70a1026)