{"record":{"id":"d700eea6ed5200cc","repo":"paperclipai/paperclip","slug":"confirmation-confirm-does-not-match-target-co","errorCode":null,"errorMessage":"Confirmation '${confirm}' does not match target company. Expected ID '${company.id}' or prefix '${company.issuePrefix}'.","messagePattern":"Confirmation '(.+?)' does not match target company\\. Expected ID '(.+?)' or prefix '(.+?)'\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1328,"sourceCode":"  );\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()) {\n    throw new Error(\n      \"Deletion requires --confirm <value> where value matches the company ID or issue prefix.\",\n    );\n  }\n}\n\nexport function registerCompanyCommands(program: Command): void {\n  const company = program.command(\"company\").description(\"Company operations\");","sourceCodeStart":1310,"sourceCodeEnd":1346,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/company.ts#L1310-L1346","documentation":"Thrown by assertDeleteConfirmation when --confirm is provided but its value matches neither the target company's id (case-sensitive) nor its issue prefix (case-insensitive). The acknowledgement must prove intent against THIS company; a mismatch suggests the operator is targeting the wrong record.","triggerScenarios":"Passing --confirm with a different company's id/prefix. Typing the prefix in the wrong case is tolerated for prefix but id match is case-sensitive. Passing --confirm yes, true, the company name, or any non-matching token. Selecting one company by selector but confirming against another.","commonSituations":"Operator pastes the wrong company's prefix. Selector resolves to company A but --confirm holds company B's prefix from a previous command. The company was renamed/re-prefixed between selector resolution and confirmation.","solutions":["Ensure --confirm matches the resolved company's id or current issue prefix exactly.","Re-run 'paperclipai company list' to read the canonical id and prefix.","Align the selector and the --confirm value so they refer to the same company.","If the prefix changed recently, use the new prefix (or the stable id) for --confirm."],"exampleFix":"# before (selector and confirm disagree)\npaperclipai company delete PAP --yes --confirm cmp_other\n# after\npaperclipai company delete PAP --yes --confirm PAP","handlingStrategy":"validation","validationCode":"function ensureConfirmMatches(company: { id: string; issuePrefix: string }, confirm: string): void {\n  const c = confirm.trim();\n  const ok = c === company.id || c.toUpperCase() === company.issuePrefix.toUpperCase();\n  if (!ok) {\n    throw new Error(`--confirm must equal id '${company.id}' or prefix '${company.issuePrefix}'.`);\n  }\n}","typeGuard":"function confirmMatchesCompany(company: { id: string; issuePrefix: string }, confirm: string): boolean {\n  const c = confirm.trim();\n  return c === company.id || c.toUpperCase() === company.issuePrefix.toUpperCase();\n}","tryCatchPattern":null,"preventionTips":["Derive --confirm from the resolved company object, not a separate clipboard copy.","Use the stable company id for --confirm when prefixes can change.","Re-resolve the company right before delete to catch renames."],"tags":["cli","validation","company-delete","destructive","mismatch"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}