nexu-io/open-design · error · Error

codex mcp remove failed: ${failureDetail(result)}

Error message

codex mcp remove failed: ${failureDetail(result)}

What it means

Thrown by uninstallCodexMcp after `codex mcp remove <name>` exits non-zero. As with add, failureDetail surfaces stderr/stdout/exit code from the Codex CLI. This path is the 'uninstall' side of the Settings one-click Codex MCP toggle.

Source

Thrown at apps/daemon/src/codex-cli.ts:115

  env: Record<string, string>;
}

export async function installCodexMcp(spec: CodexInstallSpec): Promise<void> {
  const argv: string[] = ['mcp', 'add', spec.name];
  for (const [key, value] of Object.entries(spec.env)) {
    argv.push('--env', `${key}=${value}`);
  }
  argv.push('--', spec.command, ...spec.args);
  const result = await activeRunner().run(argv);
  if (result.exitCode !== 0) {
    throw new Error(`codex mcp add failed: ${failureDetail(result)}`);
  }
}

export async function uninstallCodexMcp(name: string): Promise<void> {
  const result = await activeRunner().run(['mcp', 'remove', name]);
  if (result.exitCode !== 0) {
    throw new Error(`codex mcp remove failed: ${failureDetail(result)}`);
  }
}

function failureDetail(result: CodexRunnerResult): string {
  return result.stderr.trim() || result.stdout.trim() || `exit ${result.exitCode}`;
}

View on GitHub (pinned to 5be4028344)

Solutions

  1. Inspect the appended failureDetail for Codex's own error text.
  2. Run `codex mcp get <name>`; if it is already gone, treat the uninstall as already-complete.
  3. Open ~/.codex/config.toml and remove the entry by hand if the CLI refuses.
  4. Upgrade or reinstall the Codex CLI if the remove subcommand is malfunctioning.

Example fix

// before: remove fails because entry is absent
codex mcp remove open-design
// after: verify it is gone, then no-op
codex mcp get open-design   # not-found -> already uninstalled
Defensive patterns

Strategy: try-catch

Validate before calling

// Treat 'not installed' as success to avoid the remove failure.
const status = await probeCodexInstall(name);
if (!status.installed) return; // nothing to remove
await uninstallCodexMcp(name);

Try / catch

try {
  await uninstallCodexMcp(name);
} catch (err) {
  const detail = err instanceof Error ? err.message : String(err);
  if (/not found|no such|remove failed/i.test(detail)) {
    return; // already gone — desired state reached
  }
  throw err;
}

Prevention

When it happens

Trigger: Clicking uninstall when no server with that name is registered in ~/.codex/config.toml, when config.toml is corrupt or unwritable, or when the Codex CLI itself errors during removal.

Common situations: Stale toggle state (UI thinks it is installed but it was already removed manually), a hand-edited config.toml that breaks Codex's parser, or a Codex CLI version that changed the remove subcommand.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/3e0dc7f4db89ab76. Report an issue: GitHub.