thedotmack/claude-mem · warning

Codex marketplace is already registered from another…

Error message

  Codex marketplace ${MARKETPLACE_NAME} is already registered from another source; replacing it with ${marketplaceRoot}.

What it means

When installing Codex integration, claude-mem registers its plugin marketplace by name (MARKETPLACE_NAME). If the Codex CLI reports the marketplace is already registered but pointing at a different source path, the installer removes the existing registration and re-adds it pointing at the current marketplaceRoot. This warning tells the user an existing registration is being replaced — intentional, but destructive to the prior source.

Solutions

  1. No action needed if replacing the old source is intended — this is the desired migration behavior
  2. If the old source should be kept, cancel the install and decide which marketplace source you want, removing the other manually: codex plugin marketplace remove <name>
  3. Pin installs to one consistent source (always npx claude-mem@latest, or always a local checkout) to avoid repeated replacements
Defensive patterns

Strategy: validation

Validate before calling

import { execSync } from 'child_process';
const out = execSync('codex plugin marketplace list').toString();
const existing = out.match(/claude-mem.*?(\S+)$/m); // inspect current source before install

Try / catch

try {
  runCodex(['plugin', 'marketplace', 'add', marketplaceRoot]);
} catch (e) {
  if (isMarketplaceDifferentSourceError(e)) {
    console.warn('Replacing existing marketplace registration from another source');
    runCodex(['plugin', 'marketplace', 'remove', MARKETPLACE_NAME]);
    runCodex(['plugin', 'marketplace', 'add', marketplaceRoot]);
  } else throw e;
}

Prevention

When it happens

Trigger: registerCodexMarketplace calls `codex plugin marketplace add`, gets a 'already registered from different source' error (isMarketplaceDifferentSourceError), and falls into the warn/remove/add replacement path during performCodexInstall.

Common situations: User previously installed claude-mem's Codex plugin from a git repo and now installs from a local npx checkout (or vice versa); marketplace moved between machines/paths; testing dev builds alongside a production install.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/08ec7fc5db89a8ac. Report an issue: GitHub.

Appendix: source

Thrown at src/services/integrations/CodexCliInstaller.ts:229

}

function isMarketplaceDifferentSourceError(error: unknown): boolean {
  const message = error instanceof Error ? error.message : String(error);
  return message.includes(`marketplace '${MARKETPLACE_NAME}' is already added from a different source`)
    || message.includes(`marketplace \`${MARKETPLACE_NAME}\` is already added from a different source`);
}

function registerCodexMarketplace(marketplaceRoot: string): void {
  try {
    runCodex(['plugin', 'marketplace', 'add', marketplaceRoot]);
    return;
  } catch (error) {
    if (!isMarketplaceDifferentSourceError(error)) {
      throw error instanceof Error ? error : new Error(String(error));
    }
  }

  console.warn(`  Codex marketplace ${MARKETPLACE_NAME} is already registered from another source; replacing it with ${marketplaceRoot}.`);
  runCodex(['plugin', 'marketplace', 'remove', MARKETPLACE_NAME]);
  runCodex(['plugin', 'marketplace', 'add', marketplaceRoot]);
}

export function setTomlBooleanInTable(content: string, header: string, key: string, enabled: boolean): string {
  const booleanLine = `${key} = ${enabled ? 'true' : 'false'}`;
  const lines = content.split('\n');
  const headerIndex = lines.findIndex((line) => line.trim() === header);

  if (headerIndex === -1) {
    const trimmed = content.trimEnd();
    return `${trimmed}${trimmed ? '\n\n' : ''}${header}\n${booleanLine}\n`;
  }

  let sectionEnd = headerIndex + 1;
  while (sectionEnd < lines.length && !/^\s*\[/.test(lines[sectionEnd])) {
    sectionEnd += 1;
  }

View on GitHub (pinned to d8bc9755e7)