paperclipai/paperclip · warning · Error
Refusing to delete without --yes
Error message
Refusing to delete without --yes
What it means
Intentional safety guard in `paperclipai agent delete`. Commander wires `--yes` as the confirmation flag; the action handler refuses to proceed if opts.yes is falsy, before making any API call. No network request is issued, so this is a usage error, not a server error.
Source
Thrown at cli/src/commands/client/agent.ts:402
const ctx = resolveCommandContext(opts);
const payload = updateAgentSchema.parse(parseJson(opts.payloadJson));
const updated = await ctx.api.patch<Agent>(apiPath`/api/agents/${agentId}`, payload);
printOutput(updated, { json: ctx.json });
} catch (err) {
handleCommandError(err);
}
}),
);
addCommonClientOptions(
agent
.command("delete")
.description("Delete an agent")
.argument("<agentId>", "Agent ID")
.option("--yes", "Confirm deletion")
.action(async (agentId: string, opts: AgentDeleteOptions) => {
try {
if (!opts.yes) throw new Error("Refusing to delete without --yes");
const ctx = resolveCommandContext(opts);
const result = await ctx.api.delete(apiPath`/api/agents/${agentId}`);
printOutput(result, { json: ctx.json });
} catch (err) {
handleCommandError(err);
}
}),
);
for (const [name, path, description] of [
["pause", "pause", "Pause an agent"],
["resume", "resume", "Resume an agent"],
["approve", "approve", "Approve a pending agent"],
["terminate", "terminate", "Terminate an agent"],
["heartbeat:invoke", "heartbeat/invoke", "Invoke an agent heartbeat"],
["claude-login", "claude-login", "Trigger Claude login for an agent"],
] as const) {
addCommonClientOptions(View on GitHub (pinned to 67001ec6eb)
Solutions
- Add `--yes` to confirm: `paperclipai agent delete <agentId> --yes`.
- If scripting, set --yes explicitly in the wrapper.
- If you did not mean to delete, this throw protected you — no further action needed.
Example fix
// before paperclipai agent delete agt_123 // after paperclipai agent delete agt_123 --yes
Defensive patterns
Strategy: validation
Validate before calling
// In a wrapper script, assert confirmation before invoking.
function buildDeleteCmd(agentId: string, confirmed: boolean): string[] {
if (!confirmed) throw new Error('Refusing to build delete command without confirmation');
return ['agent', 'delete', agentId, '--yes'];
} Try / catch
try { await runAgentDelete(agentId, { yes: true }); }
catch (err) {
if (err instanceof Error && err.message === 'Refusing to delete without --yes') {
// impossible — we passed yes; surface as a logic bug
}
throw err;
} Prevention
- Always pass --yes for scripted deletes; never assume a default.
- In interactive wrappers, prompt the user once and forward --yes.
- Treat the absence of --yes as intentional protection, not friction.
When it happens
Trigger: Running `paperclipai agent delete <agentId>` without `--yes`. The default for --yes is undefined/false, so any invocation missing the flag throws.
Common situations: Operator forgot the flag. Script wrapping the CLI that did not propagate confirmation. Muscle memory from a different CLI that uses `-y` or `--force`.
Related errors
- Agent not found: ${agentRef}
- Failed to create API key
- --payload must be a JSON object
- --file is required
- Challenge secret is required. Pass --token or --token-env.
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/a81022a5c55473f0.
Report an issue: GitHub.