{"record":{"id":"5c3a849ff2d6eddf","repo":"JuliusBrussee/caveman","slug":"canonicalpath-changed-while-planning-mcp-update","errorCode":null,"errorMessage":"${canonicalPath} changed while planning MCP update; refusing overwrite","messagePattern":"(.+?) changed while planning MCP update; refusing overwrite","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":10890,"sourceCode":"      if (parent === ancestor) return absolute;\n      missing.unshift(basename(ancestor));\n      ancestor = parent;\n    }\n  }\n}\n\nfunction ownedMcpConfigPlan(\n  agent: \"kilo\" | \"qwen\",\n  path: string,\n  loaded: { bytes: Buffer | null; exists: boolean },\n  after: Buffer | null,\n): OwnedMcpConfigPlan {\n  const canonicalPath = canonicalMcpConfigPath(path);\n  let beforeMode = 0o600;\n  if (loaded.exists) {\n    beforeMode = statSync(canonicalPath).mode & 0o777;\n    if (!optionalBytesEqual(fileBytes(canonicalPath), loaded.bytes)) {\n      throw new Error(`${canonicalPath} changed while planning MCP update; refusing overwrite`);\n    }\n  }\n  return {\n    agent,\n    path: canonicalPath,\n    before: loaded.bytes,\n    beforeMode,\n    after,\n    changed: !optionalBytesEqual(loaded.bytes, after),\n  };\n}\n\nfunction movedOwnedMcpEntryState(\n  agent: \"kilo\" | \"qwen\",\n  serverName: string,\n  marker: McpServerMarker,\n): \"absent\" | \"present\" | \"ambiguous\" {\n  const activePath = canonicalMcpConfigPath(agent === \"kilo\" ? kiloConfigPath() : qwenConfigPath());","sourceCodeStart":10872,"sourceCodeEnd":10908,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/5184b3d11ac6a1acb7d44b9bfaa31698157cff97/packages/cli/src/index.ts#L10872-L10908","documentation":"Optimistic-concurrency check in ownedMcpConfigPlan: the bytes of the MCP config file on disk no longer match the bytes that were loaded when planning the update. Something modified the file between load and plan, so overwriting it would clobber concurrent changes; the plan is abandoned.","triggerScenarios":"Thrown at packages/cli/src/index.ts:10890 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run the MCP install/uninstall so it reloadads the current config and produces a fresh plan","Stop other processes (the agent itself, editors, other Caveman commands) from writing the MCP config while the transaction runs","If the concurrent change was yours, merge it into the config first, then retry the managed operation"],"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"}