{"record":{"id":"86498ddd0f8f3e71","repo":"paperclipai/paperclip","slug":"deletion-requires-yes","errorCode":null,"errorMessage":"Deletion requires --yes.","messagePattern":"Deletion requires --yes\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1315,"sourceCode":"  }\n\n  if (idMatch && prefixMatch && idMatch.id !== prefixMatch.id) {\n    throw new Error(\n      `Selector '${selector}' is ambiguous (matches both an ID and a shortname). Re-run with --by id or --by prefix.`,\n    );\n  }\n\n  if (idMatch) return idMatch;\n  if (prefixMatch) return prefixMatch;\n\n  throw new Error(\n    `No company found for selector '${selector}'. Use company ID or issue prefix (for example PAP).`,\n  );\n}\n\nexport function assertDeleteConfirmation(company: Company, opts: CompanyDeleteOptions): void {\n  if (!opts.yes) {\n    throw new Error(\"Deletion requires --yes.\");\n  }\n\n  const confirm = opts.confirm?.trim();\n  if (!confirm) {\n    throw new Error(\n      \"Deletion requires --confirm <value> where value matches the company ID or issue prefix.\",\n    );\n  }\n\n  const confirmsById = confirm === company.id;\n  const confirmsByPrefix = confirm.toUpperCase() === company.issuePrefix.toUpperCase();\n  if (!confirmsById && !confirmsByPrefix) {\n    throw new Error(\n      `Confirmation '${confirm}' does not match target company. Expected ID '${company.id}' or prefix '${company.issuePrefix}'.`,\n    );\n  }\n}\n","sourceCodeStart":1297,"sourceCodeEnd":1333,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/company.ts#L1297-L1333","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add --yes to the delete command.","If scripting, set opts.yes = true on CompanyDeleteOptions before calling assertDeleteConfirmation.","Combine --yes with the required --confirm <id-or-prefix> in the same invocation.","Read the delete command help ('paperclipai company delete --help') to see all required flags."],"exampleFix":"# before\npaperclipai company delete PAP --confirm PAP\n# after\npaperclipai company delete PAP --yes --confirm PAP","handlingStrategy":"validation","validationCode":"function requireDeleteYes(opts: { yes?: boolean }): void {\n  if (!opts.yes) throw new Error(\"Deletion requires --yes.\");\n}","typeGuard":"function deleteYesPresent(opts: { yes?: boolean }): boolean {\n  return opts.yes === true;\n}","tryCatchPattern":null,"preventionTips":["Require --yes in all delete command templates.","Set opts.yes programmatically in scripts before calling assertDeleteConfirmation.","Review required flags with '--help' after upgrades."],"tags":["cli","validation","company-delete","destructive","argument-error"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}