{"record":{"id":"e2b0d0d7f80ebffa","repo":"paperclipai/paperclip","slug":"company-selector-is-required","errorCode":null,"errorMessage":"Company selector is required.","messagePattern":"Company selector is required\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1279,"sourceCode":"  });\n\n  if (p.isCancel(confirmed) || !confirmed) {\n    throw new Error(\"Export cancelled.\");\n  }\n}\n\nfunction matchesPrefix(company: Company, selector: string): boolean {\n  return company.issuePrefix.toUpperCase() === selector.toUpperCase();\n}\n\nexport function resolveCompanyForDeletion(\n  companies: Company[],\n  selectorRaw: string,\n  by: CompanyDeleteSelectorMode = \"auto\",\n): Company {\n  const selector = normalizeSelector(selectorRaw);\n  if (!selector) {\n    throw new Error(\"Company selector is required.\");\n  }\n\n  const idMatch = companies.find((company) => company.id === selector);\n  const prefixMatch = companies.find((company) => matchesPrefix(company, selector));\n\n  if (by === \"id\") {\n    if (!idMatch) {\n      throw new Error(`No company found by ID '${selector}'.`);\n    }\n    return idMatch;\n  }\n\n  if (by === \"prefix\") {\n    if (!prefixMatch) {\n      throw new Error(`No company found by shortname/prefix '${selector}'.`);\n    }\n    return prefixMatch;\n  }","sourceCodeStart":1261,"sourceCodeEnd":1297,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/company.ts#L1261-L1297","documentation":"Thrown by resolveCompanyForDeletion when the company selector argument is empty after normalizeSelector trims it. Deletion requires an explicit identifier (id or issue prefix); an empty selector would otherwise match nothing or, worse, be ambiguous.","triggerScenarios":"Running 'paperclipai company delete' with no selector argument, an empty string, or only whitespace. A script that threads an unset environment variable as the selector.","commonSituations":"User forgets the positional selector. A wrapper script that interpolates an empty $COMPANY env var. Copy-pasting a command template without filling in the placeholder.","solutions":["Pass the company id or issue prefix: 'paperclipai company delete <id-or-prefix>'.","Run 'paperclipai company list' to find the id or prefix, then pass it.","In scripts, validate that the selector variable is non-empty before invoking delete."],"exampleFix":"# before\npaperclipai company delete --yes --confirm PAP\n# after\npaperclipai company delete PAP --yes --confirm PAP","handlingStrategy":"validation","validationCode":"function requireCompanySelector(selectorRaw: string): string {\n  const s = selectorRaw.trim();\n  if (!s) throw new Error(\"Company selector is required (id or issue prefix).\");\n  return s;\n}","typeGuard":"function hasCompanySelector(selectorRaw: string): boolean {\n  return selectorRaw.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Make the selector a required positional arg in your CLI wrappers.","Validate env-supplied selectors are non-empty before invoking delete.","Provide a 'company list' step in interactive flows before delete."],"tags":["cli","validation","company-delete","argument-error"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}