{"record":{"id":"29cc3dfd03c226dc","repo":"JuliusBrussee/caveman","slug":"markerpath-is-not-a-valid-caveman-ownership-jou","errorCode":null,"errorMessage":"${markerPath} is not a valid Caveman ownership journal; refusing overwrite","messagePattern":"(.+?) is not a valid Caveman ownership journal; refusing overwrite","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":12515,"sourceCode":"function transactOwnedMcpConfig(\n  agent: \"kilo\" | \"qwen\",\n  serverName: string,\n  action: \"install\" | \"uninstall\",\n  mcp?: { command: string; args: string[] },\n  lockedConfigPath?: string,\n): boolean {\n  const plan = action === \"install\"\n    ? agent === \"kilo\" ? planMcpKiloJson(mcp!, serverName) : planMcpQwenJson(mcp!, serverName)\n    : agent === \"kilo\" ? planRemoveMcpKiloJson(serverName) : planRemoveMcpQwenJson(serverName);\n  if (!plan) return false;\n  if (lockedConfigPath && plan.path !== canonicalMcpConfigPath(lockedConfigPath)) {\n    throw new Error(`${agent} ${serverName} MCP config target changed while acquiring lock; refusing mutation`);\n  }\n\n  const markerPath = canonicalOwnedMcpMarkerPath(agent, serverName);\n  const markerBefore = fileBytes(markerPath);\n  if (markerBefore !== null && !validMcpMarkerBytes(markerBefore, agent, serverName)) {\n    throw new Error(`${markerPath} is not a valid Caveman ownership journal; refusing overwrite`);\n  }\n  const markerBeforeMode = markerBefore === null ? 0o600 : statSync(markerPath).mode & 0o777;\n  if (!optionalBytesEqual(fileBytes(markerPath), markerBefore)) {\n    throw new Error(`${markerPath} changed while planning MCP update; refusing overwrite`);\n  }\n  const markerAfter = action === \"install\" ? mcpMarkerBytes(mcp!, mcpServerToolName(serverName)!, plan.path) : null;\n  if (!plan.changed && optionalBytesEqual(markerBefore, markerAfter)) return true;\n\n  const journal: OwnedMcpPendingJournal = {\n    schema_version: 1,\n    transaction_id: randomUUID(),\n    agent,\n    server_name: serverName,\n    action,\n    config_path: plan.path,\n    marker_path: markerPath,\n    config_before_base64: plan.before?.toString(\"base64\") ?? null,\n    config_before_mode: plan.beforeMode,","sourceCodeStart":12497,"sourceCodeEnd":12533,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/5184b3d11ac6a1acb7d44b9bfaa31698157cff97/packages/cli/src/index.ts#L12497-L12533","documentation":"Validation of the pre-existing ownership journal (marker file) under cavemanHome()/mcp before an MCP transaction writes it: the file exists but does not parse as a Caveman ownership journal. Overwriting it would destroy an unknown owner record, so the transaction refuses to proceed.","triggerScenarios":"Thrown at packages/cli/src/index.ts:12515 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the marker file named in the message; if it is stale or hand-edited, back it up and remove it, then re-run the install","If another tool created the file, reconcile ownership manually before using Caveman-managed MCP","Ensure the Caveman version writing journals matches the one reading them (no cross-version format drift)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5184b3d11ac6a1acb7d44b9bfaa31698157cff97","analyzedAt":"2026-09-06T12:00:26.372Z","contentChangedAt":"2026-09-06T12:00:26.372Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}