{"record":{"id":"f1487ac85f990ecc","repo":"paperclipai/paperclip","slug":"existing-company-imports-require-a-companyid-to-re","errorCode":null,"errorMessage":"Existing-company imports require a companyId to resolve the API route.","messagePattern":"Existing-company imports require a companyId to resolve the API route\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":781,"sourceCode":"\nfunction printCompanyImportView(title: string, body: string, opts?: { interactive?: boolean }): void {\n  if (opts?.interactive) {\n    p.note(body, title);\n    return;\n  }\n  console.log(pc.bold(title));\n  console.log(body);\n}\n\nexport function resolveCompanyImportApiPath(input: {\n  dryRun: boolean;\n  targetMode: \"new_company\" | \"existing_company\";\n  companyId?: string | null;\n}): string {\n  if (input.targetMode === \"existing_company\") {\n    const companyId = input.companyId?.trim();\n    if (!companyId) {\n      throw new Error(\"Existing-company imports require a companyId to resolve the API route.\");\n    }\n    return input.dryRun\n      ? apiPath`/api/companies/${companyId}/imports/preview`\n      : apiPath`/api/companies/${companyId}/imports/apply`;\n  }\n\n  return input.dryRun ? \"/api/companies/import/preview\" : \"/api/companies/import\";\n}\n\nexport function buildCompanyDashboardUrl(apiBase: string, issuePrefix: string): string {\n  const url = new URL(apiBase);\n  const normalizedPrefix = issuePrefix.trim().replace(/^\\/+|\\/+$/g, \"\");\n  url.pathname = `${url.pathname.replace(/\\/+$/, \"\")}/${normalizedPrefix}/dashboard`;\n  url.search = \"\";\n  url.hash = \"\";\n  return url.toString();\n}\n","sourceCodeStart":763,"sourceCodeEnd":799,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/company.ts#L763-L799","documentation":"resolveCompanyImportApiPath was asked to build an existing-company import route but the companyId option was empty or whitespace, so it cannot construct the company-scoped API path.","triggerScenarios":"Thrown at cli/src/commands/client/company.ts:781 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass --company-id (or set PAPERCLIP_COMPANY_ID / a context profile companyId) when importing into an existing company."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}