{"record":{"id":"dd67e7c623f0f1f7","repo":"paperclipai/paperclip","slug":"deletion-requires-confirm-value-where-value-ma","errorCode":null,"errorMessage":"Deletion requires --confirm <value> where value matches the company ID or issue prefix.","messagePattern":"Deletion requires --confirm <value> where value matches the company ID or issue prefix\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1320,"sourceCode":"    );\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\nfunction assertDeleteFlags(opts: CompanyDeleteOptions): void {\n  if (!opts.yes) {\n    throw new Error(\"Deletion requires --yes.\");\n  }\n  if (!opts.confirm?.trim()) {","sourceCodeStart":1302,"sourceCodeEnd":1338,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/company.ts#L1302-L1338","documentation":"Thrown by assertDeleteConfirmation when --yes is set but --confirm is missing or whitespace-only. Deletion requires a typed acknowledgement whose value matches the target company id or issue prefix, proving the operator knows exactly which company will be destroyed.","triggerScenarios":"Running 'paperclipai company delete <sel> --yes' without --confirm. Passing --confirm '' or only spaces. A script that sets yes:true but leaves confirm unset on CompanyDeleteOptions.","commonSituations":"Operator assumes --yes is enough. Script forwards --yes but not --confirm. Confusion about which value --confirm expects (it must be the id or prefix, not 'yes' or 'true').","solutions":["Add --confirm <company-id-or-prefix> matching the target.","Copy the value from 'paperclipai company list' to guarantee it matches.","In code, populate opts.confirm with company.id or company.issuePrefix before calling assertDeleteConfirmation.","Re-read the command help to confirm the expected --confirm semantics."],"exampleFix":"# before\npaperclipai company delete PAP --yes\n# after\npaperclipai company delete PAP --yes --confirm PAP","handlingStrategy":"validation","validationCode":"function requireDeleteConfirm(opts: { confirm?: string }): void {\n  if (!opts.confirm?.trim()) {\n    throw new Error(\"Deletion requires --confirm <company-id-or-prefix>.\");\n  }\n}","typeGuard":"function deleteConfirmPresent(opts: { confirm?: string }): boolean {\n  return typeof opts.confirm === \"string\" && opts.confirm.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always pair --yes with --confirm in delete invocations.","Pull the --confirm value from the same 'company list' row as the selector.","Document that --confirm expects the id or prefix, not 'yes'."],"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"}