{"record":{"id":"2f18a4e8838e04d1","repo":"JuliusBrussee/caveman","slug":"claude-caveman-cloud-mcp-changed-after-setup-refu","errorCode":null,"errorMessage":"Claude caveman-cloud MCP changed after setup; refusing to overwrite user fields","messagePattern":"Claude caveman-cloud MCP changed after setup; refusing to overwrite user fields","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":2880,"sourceCode":"    if (!existingBundle) {\n      if (current && !current.equals(Buffer.from(body))) {\n        throw new Error(`${file} already exists with non-canonical content; refusing to overwrite an unjournaled skill`);\n      }\n      continue;\n    }\n    const previous = previousSkills.get(file);\n    if (current && !current.equals(Buffer.from(body)) && (!previous || bytesHash(current) !== previous.after_sha256)) {\n      throw new Error(`${file} changed after setup; refusing to overwrite user skill edits`);\n    }\n  }\n  if (agent === \"claude\") {\n    const actual = claudeMcpRegistration(\"caveman-cloud\");\n    const marker = readMcpServerMarker(\"claude\", \"caveman-cloud\");\n    if (actual.present && !marker) {\n      throw new Error(\"Claude caveman-cloud MCP exists but is not Caveman-journaled; refusing overwrite\");\n    }\n    if (actual.present && marker && !agentNativeCloudMcpMatches(\"claude\", marker)) {\n      throw new Error(\"Claude caveman-cloud MCP changed after setup; refusing to overwrite user fields\");\n    }\n    return;\n  }\n  const config = fileBytes(join(codexHomeDir(), \"config.toml\"))?.toString(\"utf8\") ?? \"\";\n  if (!config.includes(\"[mcp_servers.caveman-cloud]\")) return;\n  if (!readMcpServerMarker(\"codex\", \"caveman-cloud\")) {\n    throw new Error(\"[mcp_servers.caveman-cloud] exists but is not Caveman-journaled; refusing overwrite\");\n  }\n}\n\nfunction installAgentNativeBundleSkills(agent: \"claude\" | \"codex\", journal: AgentNativeBundleJournal): void {\n  const originals = new Map(journal.skills.map((skill) => [skill.file, skill.before_base64]));\n  journal.skills = agentNativeSkillFiles(agent).map(({ file, body }) => {\n    mkdirSync(dirname(file), { recursive: true });\n    atomicWriteFile(file, Buffer.from(body));\n    return {\n      file,\n      before_base64: originals.get(file) ?? null,","sourceCodeStart":2862,"sourceCodeEnd":2898,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/index.ts#L2862-L2898","documentation":"For Claude, if the caveman-cloud MCP registration exists, is journaled (marker present), but its current fields no longer match the recorded marker (command/args changed), the user or another process modified the journaled entry. Overwriting would destroy those changes, so setup refuses.","triggerScenarios":"Running setup for claude when the registration is present, a marker exists, and agentNativeCloudMcpMatches('claude', marker) is false — i.e. the live config's server command/args differ from the marker's recorded values.","commonSituations":"User edited the caveman-cloud entry (different args, env, or binary path); a different Caveman version or channel changed the command; the marker is stale relative to config.","solutions":["Restore the caveman-cloud entry fields to match the marker's recorded command","Delete the stale marker so setup re-registers the entry fresh (after backing up changes)","Revert your manual edits to the MCP entry and re-run setup"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const marker = readMcpServerMarker('claude', 'caveman-cloud');\nif (marker && !agentNativeCloudMcpMatches('claude', marker)) {\n  console.error('caveman-cloud entry differs from marker; revert edits or remove the marker deliberately.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  runSetup('claude');\n} catch (e) {\n  if (String(e.message).includes('refusing to overwrite user fields')) {\n    // revert the entry to the marker-recorded command or delete marker + entry for a clean re-register\n  }\n}","preventionTips":["Avoid editing command/args of journaled MCP entries","Re-run the Caveman CLI (not manual edits) to change the server command","Keep Claude config and markers in sync — don't restore configs from backups without markers"],"tags":["mcp-config","marker","user-edits","claude"],"backgroundTag":"checksum-mismatch","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}