paperclipai/paperclip · error · Error

Deletion requires --yes.

Error message

Deletion requires --yes.

What it means

Thrown by assertDeleteConfirmation when opts.yes is falsy. Company deletion is irreversible, so the library requires an explicit --yes acknowledgement from the operator; without it the function refuses to proceed before even checking --confirm.

Source

Thrown at cli/src/commands/client/company.ts:1315

  }

  if (idMatch && prefixMatch && idMatch.id !== prefixMatch.id) {
    throw new Error(
      `Selector '${selector}' is ambiguous (matches both an ID and a shortname). Re-run with --by id or --by prefix.`,
    );
  }

  if (idMatch) return idMatch;
  if (prefixMatch) return prefixMatch;

  throw new Error(
    `No company found for selector '${selector}'. Use company ID or issue prefix (for example PAP).`,
  );
}

export function assertDeleteConfirmation(company: Company, opts: CompanyDeleteOptions): void {
  if (!opts.yes) {
    throw new Error("Deletion requires --yes.");
  }

  const confirm = opts.confirm?.trim();
  if (!confirm) {
    throw new Error(
      "Deletion requires --confirm <value> where value matches the company ID or issue prefix.",
    );
  }

  const confirmsById = confirm === company.id;
  const confirmsByPrefix = confirm.toUpperCase() === company.issuePrefix.toUpperCase();
  if (!confirmsById && !confirmsByPrefix) {
    throw new Error(
      `Confirmation '${confirm}' does not match target company. Expected ID '${company.id}' or prefix '${company.issuePrefix}'.`,
    );
  }
}

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Add --yes to the delete command.
  2. If scripting, set opts.yes = true on CompanyDeleteOptions before calling assertDeleteConfirmation.
  3. Combine --yes with the required --confirm <id-or-prefix> in the same invocation.
  4. Read the delete command help ('paperclipai company delete --help') to see all required flags.

Example fix

# before
paperclipai company delete PAP --confirm PAP
# after
paperclipai company delete PAP --yes --confirm PAP
Defensive patterns

Strategy: validation

Validate before calling

function requireDeleteYes(opts: { yes?: boolean }): void {
  if (!opts.yes) throw new Error("Deletion requires --yes.");
}

Type guard

function deleteYesPresent(opts: { yes?: boolean }): boolean {
  return opts.yes === true;
}

Prevention

When it happens

Trigger: Running 'paperclipai company delete <sel>' without --yes. A wrapper script that prompts the user itself but forgets to pass --yes through. Programmatic callers that constructed CompanyDeleteOptions without setting yes.

Common situations: Operator runs delete to 'see what happens' without intending to confirm. Script author assumed the interactive prompt was enough. Flag renamed or dropped during a refactor.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/86498ddd0f8f3e71. Report an issue: GitHub.