Yeachan-Heo/oh-my-codex · warning · Error

remove aborted by user (pass --force to skip confirmation)

Error message

remove aborted by user (pass --force to skip confirmation)

What it means

Interactive agent removal asked for confirmation and the user answered anything other than y/yes, so the removal is aborted before the file is deleted. This is a deliberate user cancellation, surfaced as an error with a hint to pass --force.

Source

Thrown at src/cli/agents.ts:237

    shell: true,
    env: process.env,
  });
  if (result.status !== 0) {
    throw new Error(`editor exited with status ${result.status ?? 'unknown'}`);
  }
  return path;
}

async function removeNativeAgent(
  name: string,
  options: { cwd?: string; scope?: AgentScope; force?: boolean } = {},
): Promise<string> {
  ensureInteractiveRemove(Boolean(options.force));
  const path = resolveExistingAgentPath(name, options);
  if (!options.force) {
    const confirmed = await confirmRemove(path);
    if (!confirmed) {
      throw new Error('remove aborted by user (pass --force to skip confirmation)');
    }
  }
  await rm(path, { force: true });
  return path;
}

function printAgentsTable(agents: NativeAgentInfo[]): void {
  if (agents.length === 0) {
    console.log('No native agents found.');
    return;
  }

  const rows = [
    ['scope', 'name', 'model', 'description'],
    ...agents.map((agent) => [
      agent.scope,
      agent.name,
      agent.model ?? '-',

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Re-run and answer y to confirm, if deletion is intended
  2. Add --force for unattended deletion
  3. Double-check the agent path shown in the prompt before confirming

Example fix

# before
omx agent remove reviewer  # answered: n

# after
omx agent remove reviewer --force
Defensive patterns

Strategy: fallback

Validate before calling

// Skip the prompt entirely when deletion is pre-approved
await removeNativeAgent(name, { force: preApproved });

Try / catch

try {
  await removeNativeAgent(name);
} catch (e) {
  if (e instanceof Error && e.message.includes('remove aborted by user')) return; // user cancelled: not an error
  throw e;
}

Prevention

When it happens

Trigger: Answering 'n' or pressing Enter at the `Delete native agent <path>? [y/N]:` prompt.

Common situations: Changing your mind during cleanup, hesitating on the wrong agent, or scripted input that sends 'n' or newline.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/30d491fe1661e242. Report an issue: GitHub.