JuliusBrussee/caveman · error · Error

${canonicalPath} changed while planning MCP update; refusing

Error message

${canonicalPath} changed while planning MCP update; refusing overwrite

What it means

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.

Source

Thrown at packages/cli/src/index.ts:10890

      if (parent === ancestor) return absolute;
      missing.unshift(basename(ancestor));
      ancestor = parent;
    }
  }
}

function ownedMcpConfigPlan(
  agent: "kilo" | "qwen",
  path: string,
  loaded: { bytes: Buffer | null; exists: boolean },
  after: Buffer | null,
): OwnedMcpConfigPlan {
  const canonicalPath = canonicalMcpConfigPath(path);
  let beforeMode = 0o600;
  if (loaded.exists) {
    beforeMode = statSync(canonicalPath).mode & 0o777;
    if (!optionalBytesEqual(fileBytes(canonicalPath), loaded.bytes)) {
      throw new Error(`${canonicalPath} changed while planning MCP update; refusing overwrite`);
    }
  }
  return {
    agent,
    path: canonicalPath,
    before: loaded.bytes,
    beforeMode,
    after,
    changed: !optionalBytesEqual(loaded.bytes, after),
  };
}

function movedOwnedMcpEntryState(
  agent: "kilo" | "qwen",
  serverName: string,
  marker: McpServerMarker,
): "absent" | "present" | "ambiguous" {
  const activePath = canonicalMcpConfigPath(agent === "kilo" ? kiloConfigPath() : qwenConfigPath());

View on GitHub (pinned to 5184b3d11a)

Solutions

  1. Re-run the MCP install/uninstall so it reloadads the current config and produces a fresh plan
  2. Stop other processes (the agent itself, editors, other Caveman commands) from writing the MCP config while the transaction runs
  3. If the concurrent change was yours, merge it into the config first, then retry the managed operation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cli/src/index.ts:10890 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@5184b3d11a (2026-09-06). Data as JSON: /api/errors/5c3a849ff2d6eddf. Report an issue: GitHub.