paperclipai/paperclip · error · Error

Applying a company import with --json requires --yes. Use --

Error message

Applying a company import with --json requires --yes. Use --dry-run first to inspect the preview.

What it means

Thrown by resolveCompanyImportApplyConfirmationMode when an import apply is requested with --json but without --yes. JSON output mode is non-interactive by design, so there is no way to surface a confirmation prompt; the library refuses to apply blindly and tells the caller to inspect --dry-run first.

Source

Thrown at cli/src/commands/client/company.ts:809

export function buildCompanyDashboardUrl(apiBase: string, issuePrefix: string): string {
  const url = new URL(apiBase);
  const normalizedPrefix = issuePrefix.trim().replace(/^\/+|\/+$/g, "");
  url.pathname = `${url.pathname.replace(/\/+$/, "")}/${normalizedPrefix}/dashboard`;
  url.search = "";
  url.hash = "";
  return url.toString();
}

export function resolveCompanyImportApplyConfirmationMode(input: {
  yes?: boolean;
  interactive: boolean;
  json: boolean;
}): "skip" | "prompt" {
  if (input.yes) {
    return "skip";
  }
  if (input.json) {
    throw new Error(
      "Applying a company import with --json requires --yes. Use --dry-run first to inspect the preview.",
    );
  }
  if (!input.interactive) {
    throw new Error(
      "Applying a company import from a non-interactive terminal requires --yes. Use --dry-run first to inspect the preview.",
    );
  }
  return "prompt";
}

export function isHttpUrl(input: string): boolean {
  return /^https?:\/\//i.test(input.trim());
}

export function looksLikeRepoUrl(input: string): boolean {
  try {
    const url = new URL(input.trim());

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Add --yes to the command: 'paperclipai company import ... --json --yes'.
  2. Run with --dry-run --json first to inspect the preview, then re-run the apply with --yes --json.
  3. If you want an interactive prompt, drop --json so the prompt can be shown.
  4. In code, ensure input.yes is true whenever input.json is true before calling resolveCompanyImportApplyConfirmationMode.

Example fix

# before
paperclipai company import pkg.zip --target existing-company --company-id cmp_abc --json
# after
paperclipai company import pkg.zip --target existing-company --company-id cmp_abc --json --yes
Defensive patterns

Strategy: validation

Validate before calling

function validateApplyMode(input: { yes?: boolean; json: boolean }): void {
  if (input.json && !input.yes) {
    throw new Error("--json apply requires --yes. Run --dry-run --json first.");
  }
}

Type guard

function applyModeIsSafe(input: { yes?: boolean; json: boolean }): boolean {
  return !input.json || input.yes === true;
}

Prevention

When it happens

Trigger: Running 'paperclipai company import ... --json' without --yes and without --dry-run. Calling the apply path from a CI script that pipes --json for parsing but omits --yes. Any programmatic caller passing json:true, yes:false, and a dryRun:false path.

Common situations: CI pipelines that want structured output but were copy-pasted from the interactive docs without --yes. Wrapper scripts that always set --json and only learned about --yes after the first failure.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/1598baa668f506d0. Report an issue: GitHub.