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
- Re-run and answer y to confirm, if deletion is intended
- Add --force for unattended deletion
- 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
- Treat user-declined confirmation as a normal cancel, not a failure
- Use --force only in contexts where deletion is unquestionably intended
- Show the agent path in your own wrapper before invoking remove
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
- agent name must not be empty
- invalid agent name: ${name}
- \"${trimmed}\" is reserved by Codex built-in agents
- Expected --scope user|project
- agent already exists: ${path}
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/30d491fe1661e242.
Report an issue: GitHub.