JuliusBrussee/caveman · error

: MCP ownership journal failed; native config may already…

Error message

${a.display_name}: MCP ownership journal failed; native config may already contain the registration: ${(error as Error).message}

What it means

Wraps any error thrown by the ownership-journal portion of an MCP install: the journaled registration could not be recorded/validated, so the agent's native config may (or may not) already contain the registration. The agent's display name is prefixed.

Solutions

  1. Read the wrapped message to find the underlying journal failure
  2. Inspect the agent's native config to see whether the MCP registration already exists
  3. Fix permissions/corruption on the journal file, or reset it and re-run install
  4. Re-run the MCP install command after clearing the inconsistent state

Example fix

// before: corrupt journal
{ "pending": {"agent": "kilo" // truncated
// after: reset journal then re-install
rm ~/.caveman/mcp-journal.json && caveman mcp install
Defensive patterns

Strategy: try-catch

Validate before calling

if (!fs.accessSync(journalPath, fs.constants.W_OK)) throw new Error('journal not writable');

Try / catch

try { installMcp(a, serverName) } catch (e) {
  // message contains 'ownership journal failed'; check native config for existing registration
  if (nativeConfigHasRegistration(agent, serverName)) { /* clean up or accept */ }
}

Prevention

When it happens

Trigger: installOne() for any agent where the journal write/read step throws — journal file unwritable, corrupt JSON in the journal, or a sub-step (e.g. native config update) raising inside the try block.

Common situations: First-ever install on a machine with read-only config dirs; interrupted prior install left a corrupt journal; agent config format changed between versions.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/da58279ecdc4ecd9. Report an issue: GitHub.

Appendix: source

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

    preflightMcpServerMarker(a.id, serverName);
    const installOne = (lockedConfigPath?: string): boolean => {
      if (a.id === "kilo" || a.id === "qwen") {
        return transactOwnedMcpConfig(a.id, serverName, "install", mcp, lockedConfigPath);
      }
      if (!installMcpForAgent(a, mcp, serverName)) return false;
      try {
        if (serverName === "caveman") {
          writeMcpMarker(a.id, mcp);
        } else {
          writeMcpServerMarker(
            a.id,
            serverName,
            mcp,
            serverName === "caveman-browse" ? "caveman_browse" : serverName === "caveman-delegate" ? "caveman_delegate" : "caveman_context",
          );
        }
      } catch (error) {
        throw new Error(`${a.display_name}: MCP ownership journal failed; native config may already contain the registration: ${(error as Error).message}`);
      }
      return true;
    };
    const installedForAgent = a.id === "kilo" || a.id === "qwen"
      ? withOwnedMcpTransactionLock(a.id, serverName, installOne)
      : installOne();
    if (installedForAgent) {
      installed++;
      const tool = serverName === "caveman"
        ? "caveman_retrieve"
        : serverName === "caveman-browse"
          ? "caveman_browse"
          : serverName === "caveman-delegate"
            ? "caveman_delegate"
            : "caveman cloud tools";
      process.stderr.write(`${mark("ok")} ${a.display_name}: ${tool} installed\n`);
    }
  }

View on GitHub (pinned to 3ee70a1026)