EveryInc/compound-engineering-plugin · error · Error

Marketplace ${OFFICIAL_MARKETPLACE} exists with an unexpecte

Error message

Marketplace ${OFFICIAL_MARKETPLACE} exists with an unexpected source; refusing to replace it

What it means

`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.

Source

Thrown at src/dev/codex-dev.ts:598

  return parseJson<{ marketplaces?: Marketplace[] }>(result, "codex plugin marketplace list").marketplaces ?? []
}

async function ensureOfficialMarketplace(context: CodexDevContext, runner: CommandRunner): Promise<void> {
  const marketplaces = await listMarketplaces(context, runner)
  const existing = marketplaces.find((marketplace) => marketplace.name === OFFICIAL_MARKETPLACE)
  if (!existing) {
    await runCodex(context, runner, [
      "plugin",
      "marketplace",
      "add",
      "EveryInc/compound-engineering-plugin",
      "--json",
    ])
  } else if (
    existing.marketplaceSource?.sourceType !== "git" ||
    normalizedGitUrl(existing.marketplaceSource.source) !== normalizedGitUrl(OFFICIAL_REPOSITORY)
  ) {
    throw new Error(
      `Marketplace ${OFFICIAL_MARKETPLACE} exists with an unexpected source; refusing to replace it`,
    )
  }
  await runCodex(context, runner, [
    "plugin",
    "marketplace",
    "upgrade",
    OFFICIAL_MARKETPLACE,
    "--json",
  ])
}

export async function switchToRemote(
  context: CodexDevContext,
  runner: CommandRunner = new BunCommandRunner(),
): Promise<CodexDevStatus> {
  const collection = await inspectLocalCollection(context)
  if (collection.kind === "collision" || collection.kind === "unrelated" || collection.kind === "broken") {

View on GitHub (pinned to c9c10f8c75)

Solutions

  1. Run `codex plugin marketplace list --json` and inspect the source of `compound-engineering-plugin`
  2. If it is unwanted, remove it with `codex plugin marketplace remove compound-engineering-plugin`, then retry `codex:dev -- remote`
  3. If it points at a fork but you intend the official one, remove and re-add the official marketplace
  4. If it is intentional (e.g. your own fork), keep local mode instead of switching to remote

Example fix

// before: fork marketplace under the official name
await runCodex(context, runner, ["plugin", "marketplace", "add", "me/plugin"])
await switchToRemote(context, runner) // throws
// after: official marketplace
await runCodex(context, runner, ["plugin", "marketplace", "remove", "compound-engineering-plugin"])
await switchToRemote(context, runner)
Defensive patterns

Strategy: validation

Validate before calling

const marketplaces = JSON.parse((await runner.run("codex", ["plugin", "marketplace", "list", "--json"])).stdout)
const existing = marketplaces.find((m: { name: string }) => m.name === "compound-engineering-plugin")
if (existing && !JSON.stringify(existing).includes("EveryInc/compound-engineering-plugin")) {
  throw new Error("Official marketplace name occupied by a non-official source; resolve manually")
}

Type guard

function isOfficialMarketplaceSource(m?: { marketplaceSource?: { sourceType?: string; source?: string } }): boolean {
  return m?.marketplaceSource?.sourceType === "git" &&
    m.marketplaceSource.source?.includes("EveryInc/compound-engineering-plugin") === true
}

Try / catch

try {
  await switchToRemote(context, runner)
} catch (error) {
  if (String(error).includes("unexpected source")) {
    console.error("Resolve the marketplace named compound-engineering-plugin manually before switching to remote")
  } else throw error
}

Prevention

When it happens

Trigger: 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`.

Common situations: 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.

Related errors


AI-assisted analysis of EveryInc/compound-engineering-plugin@c9c10f8c75 (2026-08-31). Data as JSON: /api/errors/575a8a606467ac61. Report an issue: GitHub.