{"record":{"id":"575a8a606467ac61","repo":"EveryInc/compound-engineering-plugin","slug":"marketplace-official-marketplace-exists-with-an","errorCode":null,"errorMessage":"Marketplace ${OFFICIAL_MARKETPLACE} exists with an unexpected source; refusing to replace it","messagePattern":"Marketplace (.+?) exists with an unexpected source; refusing to replace it","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/dev/codex-dev.ts","lineNumber":598,"sourceCode":"  return parseJson<{ marketplaces?: Marketplace[] }>(result, \"codex plugin marketplace list\").marketplaces ?? []\n}\n\nasync function ensureOfficialMarketplace(context: CodexDevContext, runner: CommandRunner): Promise<void> {\n  const marketplaces = await listMarketplaces(context, runner)\n  const existing = marketplaces.find((marketplace) => marketplace.name === OFFICIAL_MARKETPLACE)\n  if (!existing) {\n    await runCodex(context, runner, [\n      \"plugin\",\n      \"marketplace\",\n      \"add\",\n      \"EveryInc/compound-engineering-plugin\",\n      \"--json\",\n    ])\n  } else if (\n    existing.marketplaceSource?.sourceType !== \"git\" ||\n    normalizedGitUrl(existing.marketplaceSource.source) !== normalizedGitUrl(OFFICIAL_REPOSITORY)\n  ) {\n    throw new Error(\n      `Marketplace ${OFFICIAL_MARKETPLACE} exists with an unexpected source; refusing to replace it`,\n    )\n  }\n  await runCodex(context, runner, [\n    \"plugin\",\n    \"marketplace\",\n    \"upgrade\",\n    OFFICIAL_MARKETPLACE,\n    \"--json\",\n  ])\n}\n\nexport async function switchToRemote(\n  context: CodexDevContext,\n  runner: CommandRunner = new BunCommandRunner(),\n): Promise<CodexDevStatus> {\n  const collection = await inspectLocalCollection(context)\n  if (collection.kind === \"collision\" || collection.kind === \"unrelated\" || collection.kind === \"broken\") {","sourceCodeStart":580,"sourceCodeEnd":616,"githubUrl":"https://github.com/EveryInc/compound-engineering-plugin/blob/c9c10f8c75412c7232cb2bd663e5fd1cea98d84e/src/dev/codex-dev.ts#L580-L616","documentation":"`ensureOfficialMarketplace()` only adds the official marketplace when it is absent; if a marketplace named `compound-engineering-plugin` already exists but points at something other than a git clone of the official repository, the function refuses to overwrite it and throws this error instead of silently replacing a user's configuration.","triggerScenarios":"Calling `switchToRemote(context, runner)` when `codex plugin marketplace list --json` reports a marketplace named `compound-engineering-plugin` whose `marketplaceSource` is not `git` type or whose URL does not normalize to `https://github.com/EveryInc/compound-engineering-plugin`.","commonSituations":"The user previously added the marketplace from a local path (`sourceType: \"path\"`) or a fork's URL; the marketplace was installed from a different clone URL (SSH vs HTTPS counts only if normalization differs, but a fork does trigger this); leftover state from testing a custom marketplace under the same name.","solutions":["Run `codex plugin marketplace list --json` and inspect the source of `compound-engineering-plugin`","If it is unwanted, remove it with `codex plugin marketplace remove compound-engineering-plugin`, then retry `codex:dev -- remote`","If it points at a fork but you intend the official one, remove and re-add the official marketplace","If it is intentional (e.g. your own fork), keep local mode instead of switching to remote"],"exampleFix":"// before: fork marketplace under the official name\nawait runCodex(context, runner, [\"plugin\", \"marketplace\", \"add\", \"me/plugin\"])\nawait switchToRemote(context, runner) // throws\n// after: official marketplace\nawait runCodex(context, runner, [\"plugin\", \"marketplace\", \"remove\", \"compound-engineering-plugin\"])\nawait switchToRemote(context, runner)","handlingStrategy":"validation","validationCode":"const marketplaces = JSON.parse((await runner.run(\"codex\", [\"plugin\", \"marketplace\", \"list\", \"--json\"])).stdout)\nconst existing = marketplaces.find((m: { name: string }) => m.name === \"compound-engineering-plugin\")\nif (existing && !JSON.stringify(existing).includes(\"EveryInc/compound-engineering-plugin\")) {\n  throw new Error(\"Official marketplace name occupied by a non-official source; resolve manually\")\n}","typeGuard":"function isOfficialMarketplaceSource(m?: { marketplaceSource?: { sourceType?: string; source?: string } }): boolean {\n  return m?.marketplaceSource?.sourceType === \"git\" &&\n    m.marketplaceSource.source?.includes(\"EveryInc/compound-engineering-plugin\") === true\n}","tryCatchPattern":"try {\n  await switchToRemote(context, runner)\n} catch (error) {\n  if (String(error).includes(\"unexpected source\")) {\n    console.error(\"Resolve the marketplace named compound-engineering-plugin manually before switching to remote\")\n  } else throw error\n}","preventionTips":["Never add a fork or path-based marketplace under the official name `compound-engineering-plugin`","Check `codex plugin marketplace list --json` before running codex:dev remote","Use codex:dev local mode when developing against a fork"],"tags":["codex","marketplace","refuse-overwrite"],"backgroundTag":"marketplace-source-conflict","analyzedSha":"c9c10f8c75412c7232cb2bd663e5fd1cea98d84e","analyzedAt":"2026-08-31T15:18:07.959Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}