{"record":{"id":"a73dca3596e828de","repo":"paperclipai/paperclip","slug":"invalid-target-value-use-new-existing","errorCode":null,"errorMessage":"Invalid --target value. Use: new | existing","messagePattern":"Invalid --target value\\. Use: new \\| existing","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1678,"sourceCode":"          }\n          const ctx = resolveCommandContext(opts);\n          const interactiveView = isInteractiveTerminal() && !ctx.json;\n          const from = fromPathOrUrl.trim();\n          if (!from) {\n            throw new Error(\"Source path or URL is required.\");\n          }\n\n          const include = resolveImportInclude(opts.include);\n          const agents = parseAgents(opts.agents);\n          const collision = (opts.collision ?? \"rename\").toLowerCase() as CompanyCollisionMode;\n          if (![\"rename\", \"skip\", \"replace\"].includes(collision)) {\n            throw new Error(\"Invalid --collision value. Use: rename, skip, replace\");\n          }\n\n          const inferredTarget = opts.target ?? (opts.companyId || ctx.companyId ? \"existing\" : \"new\");\n          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","sourceCodeStart":1660,"sourceCodeEnd":1696,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/company.ts#L1660-L1696","documentation":"The --target option (after inference) is neither 'new' nor 'existing', so the import command cannot decide which API route shape to use.","triggerScenarios":"Thrown at cli/src/commands/client/company.ts:1678 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass --target with one of: new, 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"}