{"record":{"id":"4f830015b1b4bd75","repo":"EveryInc/compound-engineering-plugin","slug":"could-not-verify-the-official-marketplace-backed-c","errorCode":null,"errorMessage":"Could not verify the official marketplace-backed Compound Engineering plugin","messagePattern":"Could not verify the official marketplace-backed Compound Engineering plugin","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/dev/codex-dev.ts","lineNumber":633,"sourceCode":"  const collection = await inspectLocalCollection(context)\n  if (collection.kind === \"collision\" || collection.kind === \"unrelated\" || collection.kind === \"broken\") {\n    throw new Error(`Cannot switch to remote mode while the local collection is ${collection.kind}`)\n  }\n\n  await ensureOfficialMarketplace(context, runner)\n  const plugins = await listCompoundEngineeringPlugins(context, runner)\n  await removePlugins(\n    context,\n    runner,\n    collection.kind === \"valid\"\n      ? plugins\n      : plugins.filter((entry) => entry.pluginId !== OFFICIAL_PLUGIN_ID),\n  )\n  await runCodex(context, runner, [\"plugin\", \"add\", OFFICIAL_PLUGIN_ID, \"--json\"])\n\n  const installed = await listCompoundEngineeringPlugins(context, runner)\n  if (installed.length !== 1 || !isOfficialMarketplacePlugin(installed[0]!)) {\n    throw new Error(\"Could not verify the official marketplace-backed Compound Engineering plugin\")\n  }\n\n  await removeLocalCollection(context)\n  const status = await inspectCodexDevStatus(context, runner)\n  if (status.mode !== \"remote\") {\n    throw new Error(`Could not verify remote Codex mode (reported ${status.mode})`)\n  }\n  return status\n}\n\nexport async function removeCodexDevInstallation(\n  context: CodexDevContext,\n  runner: CommandRunner = new BunCommandRunner(),\n): Promise<CodexDevStatus> {\n  const plugins = await listCompoundEngineeringPlugins(context, runner)\n  await removeLocalPluginConflicts(context, runner, plugins)\n  await removeLocalCollection(context)\n  const status = await inspectCodexDevStatus(context, runner)","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/EveryInc/compound-engineering-plugin/blob/c9c10f8c75412c7232cb2bd663e5fd1cea98d84e/src/dev/codex-dev.ts#L615-L651","documentation":"After switching to remote mode, `switchToRemote()` re-lists installed Compound Engineering plugins and requires exactly one plugin that is the official marketplace-backed one (`isOfficialMarketplacePlugin`). If the count is zero, more than one, or the single plugin is not marketplace-backed, the switch did not produce the expected end state and this error is thrown.","triggerScenarios":"Calling `switchToRemote(context, runner)` when `codex plugin add OFFICIAL_PLUGIN_ID --json` silently failed to enable/install, an extra Compound Engineering plugin entry survived removal, or the installed plugin's marketplace name does not match the official marketplace.","commonSituations":"Codex CLI version with changed `plugin add` semantics; stale disabled plugin entries in config.toml; plugin added from a non-official marketplace name.","solutions":["Run `codex:dev -- status` and inspect the plugin list","Run `bun run codex:dev -- remove`, then retry `codex:dev -- remote`","Manually run `codex plugin list --json` to see duplicates and remove extras with `codex plugin remove <id>`","Verify the official marketplace is present and correct (see error 41)"],"exampleFix":"// after\nawait runCodex(context, runner, [\"plugin\", \"list\", \"--json\"]) // inspect duplicates\nawait removeCodexDevInstallation(context, runner)\nawait switchToRemote(context, runner)","handlingStrategy":"try-catch","validationCode":"const plugins = await listCompoundEngineeringPlugins(context, runner)\nif (plugins.length > 1) {\n  await removePlugins(context, runner, plugins)\n}","typeGuard":"function hasExactlyOfficial(plugins: InstalledPlugin[]): boolean {\n  return plugins.length === 1 && plugins[0]!.marketplaceName === \"compound-engineering-plugin\"\n}","tryCatchPattern":"try {\n  await switchToRemote(context, runner)\n} catch (error) {\n  if (String(error).includes(\"official marketplace-backed\")) {\n    await removeCodexDevInstallation(context, runner)\n    await switchToRemote(context, runner)\n  } else throw error\n}","preventionTips":["Keep only one Compound Engineering plugin configured in Codex","Ensure the official marketplace is registered before switching to remote","Use a current Codex CLI so `plugin add --json` behaves as expected"],"tags":["codex","plugin-install","state-verification"],"backgroundTag":"codex-dev-mode-mismatch","analyzedSha":"c9c10f8c75412c7232cb2bd663e5fd1cea98d84e","analyzedAt":"2026-08-31T15:18:07.959Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}