paperclipai/paperclip · error · Error
Invalid --target value. Use: new | existing
Error message
Invalid --target value. Use: new | existing
What it means
The --target option (after inference) is neither 'new' nor 'existing', so the import command cannot decide which API route shape to use.
Solutions
- Pass --target with one of: new, existing.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cli/src/commands/client/company.ts:1678 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/a73dca3596e828de.
Report an issue: GitHub.
Appendix: source
Thrown at cli/src/commands/client/company.ts:1678
}
const ctx = resolveCommandContext(opts);
const interactiveView = isInteractiveTerminal() && !ctx.json;
const from = fromPathOrUrl.trim();
if (!from) {
throw new Error("Source path or URL is required.");
}
const include = resolveImportInclude(opts.include);
const agents = parseAgents(opts.agents);
const collision = (opts.collision ?? "rename").toLowerCase() as CompanyCollisionMode;
if (!["rename", "skip", "replace"].includes(collision)) {
throw new Error("Invalid --collision value. Use: rename, skip, replace");
}
const inferredTarget = opts.target ?? (opts.companyId || ctx.companyId ? "existing" : "new");
const target = inferredTarget.toLowerCase() as CompanyImportTargetMode;
if (!["new", "existing"].includes(target)) {
throw new Error("Invalid --target value. Use: new | existing");
}
const existingTargetCompanyId = opts.companyId?.trim() || ctx.companyId;
const targetPayload =
target === "existing"
? {
mode: "existing_company" as const,
companyId: existingTargetCompanyId,
}
: {
mode: "new_company" as const,
newCompanyName: opts.newCompanyName?.trim() || null,
};
if (targetPayload.mode === "existing_company" && !targetPayload.companyId) {
throw new Error("Target existing company requires --company-id (or context default companyId).");
}
View on GitHub (pinned to 120ae5428f)