{"record":{"id":"978a46ae0480a16b","repo":"JuliusBrussee/caveman","slug":"mcp-servers-caveman-cloud-exists-but-is-not-cave","errorCode":null,"errorMessage":"[mcp_servers.caveman-cloud] exists but is not Caveman-journaled; refusing overwrite","messagePattern":"\\[mcp_servers\\.caveman-cloud\\] exists but is not Caveman-journaled; refusing overwrite","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":2887,"sourceCode":"    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,\n      after_sha256: bytesHash(Buffer.from(body)),\n    };\n  });\n}\n\nfunction verifyAgentNativeBundle(agent: \"claude\" | \"codex\", journal: AgentNativeBundleJournal, cloudMcp: { command: string; args: string[] }): void {\n  const status = nativeIntegrationStatus(agent);","sourceCodeStart":2869,"sourceCodeEnd":2905,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/index.ts#L2869-L2905","documentation":"For Codex, setup checks config.toml for a [mcp_servers.caveman-cloud] section. If present but no Caveman journal marker exists for it, the entry may be user-created or foreign, so the CLI refuses to overwrite it — mirroring the Claude-side guard.","triggerScenarios":"Running setup for codex when the config contains the literal section header '[mcp_servers.caveman-cloud]' but readMcpServerMarker('codex','caveman-cloud') returns null.","commonSituations":"User hand-added the server to ~/.codex/config.toml; marker file removed by a cleaner; migrating from an older install that did not write markers.","solutions":["Delete the manual [mcp_servers.caveman-cloud] section from codex config.toml and let setup install it journaled","Recreate the Caveman marker for the codex caveman-cloud server if the entry is genuinely Caveman-managed","Rename your manual server section to a non-colliding name"],"exampleFix":"// before (config.toml)\n[mcp_servers.caveman-cloud]\ncommand = \"my-own-command\"\n// after\n// remove the section, then run setup so it is installed with a journal marker","handlingStrategy":"validation","validationCode":"const config = readFileSync(join(codexHomeDir(), 'config.toml'), 'utf8');\nif (config.includes('[mcp_servers.caveman-cloud]') && !readMcpServerMarker('codex', 'caveman-cloud')) {\n  console.error('Unjournaled caveman-cloud section in config.toml; remove it or restore the marker.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  runSetup('codex');\n} catch (e) {\n  if (String(e.message).includes('not Caveman-journaled')) {\n    // delete the [mcp_servers.caveman-cloud] section from config.toml and re-run setup\n  }\n}","preventionTips":["Install the codex MCP server via the Caveman CLI so a marker is written","Do not hand-copy server sections between machines without markers","Keep ~/.codex marker files alongside config.toml backups"],"tags":["mcp-config","codex","marker","overwrite-protection"],"backgroundTag":"file-already-exists","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"}