{"record":{"id":"da58279ecdc4ecd9","repo":"JuliusBrussee/caveman","slug":"a-display-name-mcp-ownership-journal-failed-native-config","errorCode":null,"errorMessage":"${a.display_name}: MCP ownership journal failed; native config may already contain the registration: ${(error as Error).message}","messagePattern":"(.+?): MCP ownership journal failed; native config may already contain the registration: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/index.ts","lineNumber":13047,"sourceCode":"    preflightMcpServerMarker(a.id, serverName);\n    const installOne = (lockedConfigPath?: string): boolean => {\n      if (a.id === \"kilo\" || a.id === \"qwen\") {\n        return transactOwnedMcpConfig(a.id, serverName, \"install\", mcp, lockedConfigPath);\n      }\n      if (!installMcpForAgent(a, mcp, serverName)) return false;\n      try {\n        if (serverName === \"caveman\") {\n          writeMcpMarker(a.id, mcp);\n        } else {\n          writeMcpServerMarker(\n            a.id,\n            serverName,\n            mcp,\n            serverName === \"caveman-browse\" ? \"caveman_browse\" : serverName === \"caveman-delegate\" ? \"caveman_delegate\" : \"caveman_context\",\n          );\n        }\n      } catch (error) {\n        throw new Error(`${a.display_name}: MCP ownership journal failed; native config may already contain the registration: ${(error as Error).message}`);\n      }\n      return true;\n    };\n    const installedForAgent = a.id === \"kilo\" || a.id === \"qwen\"\n      ? withOwnedMcpTransactionLock(a.id, serverName, installOne)\n      : installOne();\n    if (installedForAgent) {\n      installed++;\n      const tool = serverName === \"caveman\"\n        ? \"caveman_retrieve\"\n        : serverName === \"caveman-browse\"\n          ? \"caveman_browse\"\n          : serverName === \"caveman-delegate\"\n            ? \"caveman_delegate\"\n            : \"caveman cloud tools\";\n      process.stderr.write(`${mark(\"ok\")} ${a.display_name}: ${tool} installed\\n`);\n    }\n  }","sourceCodeStart":13029,"sourceCodeEnd":13065,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/cli/src/index.ts#L13029-L13065","documentation":"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.","triggerScenarios":"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.","commonSituations":"First-ever install on a machine with read-only config dirs; interrupted prior install left a corrupt journal; agent config format changed between versions.","solutions":["Read the wrapped message to find the underlying journal failure","Inspect the agent's native config to see whether the MCP registration already exists","Fix permissions/corruption on the journal file, or reset it and re-run install","Re-run the MCP install command after clearing the inconsistent state"],"exampleFix":"// before: corrupt journal\n{ \"pending\": {\"agent\": \"kilo\" // truncated\n// after: reset journal then re-install\nrm ~/.caveman/mcp-journal.json && caveman mcp install","handlingStrategy":"try-catch","validationCode":"if (!fs.accessSync(journalPath, fs.constants.W_OK)) throw new Error('journal not writable');","typeGuard":null,"tryCatchPattern":"try { installMcp(a, serverName) } catch (e) {\n  // message contains 'ownership journal failed'; check native config for existing registration\n  if (nativeConfigHasRegistration(agent, serverName)) { /* clean up or accept */ }\n}","preventionTips":["Ensure config dirs exist and are writable before install","Avoid interrupting installs (SIGKILL) mid-transaction","Reset the journal after any crash before retrying"],"tags":["mcp","journal","config","install"],"backgroundTag":"file-write-failed","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}