{"record":{"id":"3f01147cfa0a6dbd","repo":"JuliusBrussee/caveman","slug":"agent-servername-mcp-transaction-lost-one-du","errorCode":null,"errorMessage":"${agent} ${serverName} MCP transaction lost one durable journal copy; refusing destructive recovery","messagePattern":"(.+?) (.+?) MCP transaction lost one durable journal copy; refusing destructive recovery","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":12479,"sourceCode":"    if (configPending) durableUnlink(configPendingPath);\n    if (locatorPending) durableUnlink(locatorPath);\n  };\n\n  if (configIsAfter && markerIsAfter) {\n    removePendingCopies();\n    process.stderr.write(`${mark(\"warn\")} finalized interrupted ${agent} ${serverName} MCP transaction\\n`);\n    return \"finalized\";\n  }\n  if (configIsBefore && markerIsBefore) {\n    removePendingCopies();\n    process.stderr.write(`${mark(\"warn\")} discarded uncommitted ${agent} ${serverName} MCP transaction\\n`);\n    return \"discarded\";\n  }\n  if ((!configIsBefore && !configIsAfter) || (!markerIsBefore && !markerIsAfter)) {\n    throw new Error(`${agent} ${serverName} MCP config or ownership journal changed during interrupted transaction; refusing destructive recovery`);\n  }\n  if (!configPending || !locatorPending) {\n    throw new Error(`${agent} ${serverName} MCP transaction lost one durable journal copy; refusing destructive recovery`);\n  }\n\n  if (!configIsBefore) {\n    durableReplaceFileIfUnchanged(configPath, configCurrent, configBefore, journal.config_before_mode);\n  }\n  if (!markerIsBefore) {\n    durableReplaceFileIfUnchanged(markerPath, markerCurrent, markerBefore, journal.marker_before_mode);\n  }\n  if (optionalBytesHash(fileBytes(configPath)) !== journal.config_before_sha256\n    || optionalBytesHash(fileBytes(markerPath)) !== journal.marker_before_sha256) {\n    throw new Error(`${agent} ${serverName} MCP rollback postflight mismatch`);\n  }\n  removePendingCopies();\n  process.stderr.write(`${mark(\"warn\")} rolled back interrupted ${agent} ${serverName} MCP transaction\\n`);\n  return \"rolled-back\";\n}\n\nfunction transactOwnedMcpConfig(","sourceCodeStart":12461,"sourceCodeEnd":12497,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/5184b3d11ac6a1acb7d44b9bfaa31698157cff97/packages/cli/src/index.ts#L12461-L12497","documentation":"Recovery guard for an interrupted MCP ownership transaction: the journal exists and hashes match, but one of the two durable pending copies (config pending or locator/journal pending) is missing. The transaction protocol requires both copies to recover safely, so destructive recovery is refused rather than guessing.","triggerScenarios":"Thrown at packages/cli/src/index.ts:12479 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Manually restore the missing pending copy from the journal's recorded before/after hashes, then re-run to let recovery complete","Remove the journal and reconcile the config and ownership marker by hand, then retry the managed install","Check for disk-full or permission errors that prevented the second durable copy from being written"],"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"}