{"record":{"id":"d9148f31ae29e77b","repo":"paperclipai/paperclip","slug":"target-existing-company-requires-company-id-or","errorCode":null,"errorMessage":"Target existing company requires --company-id (or context default companyId).","messagePattern":"Target existing company requires --company-id \\(or context default companyId\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1694,"sourceCode":"          const target = inferredTarget.toLowerCase() as CompanyImportTargetMode;\n          if (![\"new\", \"existing\"].includes(target)) {\n            throw new Error(\"Invalid --target value. Use: new | existing\");\n          }\n\n          const existingTargetCompanyId = opts.companyId?.trim() || ctx.companyId;\n          const targetPayload =\n            target === \"existing\"\n              ? {\n                  mode: \"existing_company\" as const,\n                  companyId: existingTargetCompanyId,\n                }\n              : {\n                  mode: \"new_company\" as const,\n                  newCompanyName: opts.newCompanyName?.trim() || null,\n                };\n\n          if (targetPayload.mode === \"existing_company\" && !targetPayload.companyId) {\n            throw new Error(\"Target existing company requires --company-id (or context default companyId).\");\n          }\n\n          let sourcePayload:\n            | { type: \"inline\"; rootPath?: string | null; files: Record<string, CompanyPortabilityFileEntry> }\n            | { type: \"github\"; url: string };\n          let chunkedZip: { zipBytes: Uint8Array; rootPath: string } | null = null;\n\n          const treatAsLocalPath = !isHttpUrl(from) && await pathExists(from);\n          const isGithubSource = looksLikeRepoUrl(from) || (isGithubShorthand(from) && !treatAsLocalPath);\n\n          if (isHttpUrl(from) || isGithubSource) {\n            if (!looksLikeRepoUrl(from) && !isGithubShorthand(from)) {\n              throw new Error(\n                \"Only GitHub URLs and local paths are supported for import. \" +\n                \"Generic HTTP URLs are not supported. Use a GitHub or GitHub Enterprise URL (https://github.com/... or https://ghe.example.com/...) or a local directory path.\",\n              );\n            }\n            sourcePayload = { type: \"github\", url: normalizeGithubImportSource(from, opts.ref) };","sourceCodeStart":1676,"sourceCodeEnd":1712,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/company.ts#L1676-L1712","documentation":"Target mode 'existing' was selected but neither --company-id nor the context profile's default companyId resolved to a value, so the import has no destination company.","triggerScenarios":"Thrown at cli/src/commands/client/company.ts:1694 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass --company-id (or set a context default companyId) when using --target existing."],"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"}