{"record":{"id":"7ffd67e0dad8d5d0","repo":"paperclipai/paperclip","slug":"no-company-found-for-selector-normalizedselecto","errorCode":null,"errorMessage":"No company found for selector '${normalizedSelector}'.","messagePattern":"No company found for selector '(.+?)'\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1977,"sourceCode":"            }\n          }\n\n          if (!target) {\n            try {\n              const companies = (await ctx.api.get<Company[]>(\"/api/companies\")) ?? [];\n              target = resolveCompanyForDeletion(companies, normalizedSelector, by);\n            } catch (error) {\n              if (error instanceof ApiRequestError && error.status === 403 && error.message.includes(\"Board access required\")) {\n                throw new Error(\n                  \"Board access is required to resolve companies across the instance. Use a company ID/prefix for your current company, or run with board authentication.\",\n                );\n              }\n              throw error;\n            }\n          }\n\n          if (!target) {\n            throw new Error(`No company found for selector '${normalizedSelector}'.`);\n          }\n\n          assertDeleteConfirmation(target, opts);\n\n          await ctx.api.delete<{ ok: true }>(apiPath`/api/companies/${target.id}`);\n\n          printOutput(\n            {\n              ok: true,\n              deletedCompanyId: target.id,\n              deletedCompanyName: target.name,\n              deletedCompanyPrefix: target.issuePrefix,\n            },\n            { json: ctx.json },\n          );\n        } catch (err) {\n          handleCommandError(err);\n        }","sourceCodeStart":1959,"sourceCodeEnd":1995,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/company.ts#L1959-L1995","documentation":"Thrown after all resolution strategies (by-id lookup, scoped-company match, board-wide listing) failed to assign a target company. The selector matched nothing under the active --by mode and credentials. This is the catch-all 'not found' for the delete selector.","triggerScenarios":"Selector is a prefix/ID that does not exist on the instance; selector has trailing characters or wrong casing for prefix (note: prefix match is case-insensitive in resolveCompanyForDeletion); the caller has access only to companies that do not match; --by auto tried both id and prefix and both missed.","commonSituations":"Typo in the selector; company renamed/its prefix changed; wrong instance (api-base points at staging but the company lives in prod); agent key scoped to a different company.","solutions":["List available companies to confirm the selector: `paperclipai company list --json` (board token) or `paperclipai company current --json` (agent token).","Check the api-base is correct: `paperclipai context current`.","Retry with the exact id via `--by id` once confirmed.","If using a prefix, ensure it matches the company's issuePrefix exactly (case-insensitive)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Resolve the company before delete so the selector is guaranteed to match.\nasync function resolveTargetForDelete(api: { get: (p: string, o?: { ignoreNotFound?: boolean }) => Promise<unknown> }, selector: string): Promise<string> {\n  const byId = await api.get(`/api/companies/${selector}`, { ignoreNotFound: true });\n  if (byId) return selector;\n  const all = (await api.get<unknown[]>(\"/api/companies\")) as Array<{ id: string; issuePrefix: string }>;\n  const match = all.find(c => c.issuePrefix.toUpperCase() === selector.toUpperCase());\n  if (!match) throw new Error(`No company matches selector '${selector}'`);\n  return match.id;\n}","typeGuard":"import type { Company } from \"@paperclipai/shared\";\n\nfunction isCompany(v: unknown): v is Company {\n  return !!v && typeof v === \"object\" && typeof (v as Company).id === \"string\";\n}","tryCatchPattern":"try {\n  target = resolveCompanyForDeletion(companies, selector, by);\n} catch {\n  throw new Error(`No company found for selector '${selector}'; verify with 'company list'.`);\n}","preventionTips":["Confirm the selector against `company list --json` before destructive commands.","Verify the api-base points at the right instance.","Prefer UUIDs for unambiguous selectors."],"tags":["cli","company-delete","not-found","lookup"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}