paperclipai/paperclip · info · Error

Export cancelled.

Error message

Export cancelled.

What it means

Thrown by confirmOverwriteExportDirectory when the user was shown the 'Overwrite existing files?' prompt and either cancelled (ESC/Ctrl-C via p.isCancel) or answered 'no'. This is a deliberate user-initiated abort, not a system error.

Source

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

  const entries = await readdir(root);
  if (entries.length === 0) return;

  // --force skips the guard for non-interactive/automated callers (e.g. the
  // nightly backup routine, which exports into a git clone that legitimately
  // still holds .git and BACKUP-README.md after cleaning tracked content).
  if (opts.force) return;

  if (!process.stdin.isTTY || !process.stdout.isTTY) {
    throw new Error(`Export output directory ${root} already contains files. Re-run interactively, pass --force, or choose an empty directory.`);
  }

  const confirmed = await p.confirm({
    message: `Overwrite existing files in ${root}?`,
    initialValue: false,
  });

  if (p.isCancel(confirmed) || !confirmed) {
    throw new Error("Export cancelled.");
  }
}

function matchesPrefix(company: Company, selector: string): boolean {
  return company.issuePrefix.toUpperCase() === selector.toUpperCase();
}

export function resolveCompanyForDeletion(
  companies: Company[],
  selectorRaw: string,
  by: CompanyDeleteSelectorMode = "auto",
): Company {
  const selector = normalizeSelector(selectorRaw);
  if (!selector) {
    throw new Error("Company selector is required.");
  }

  const idMatch = companies.find((company) => company.id === selector);

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Re-run the export and answer 'yes' at the prompt if overwriting is acceptable.
  2. Choose a different --out directory and re-run.
  3. Move or delete the existing files first, then re-run.
  4. Use --force to skip the prompt for trusted automated overwrites.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await confirmOverwriteExportDirectory(outDir);
} catch (err) {
  if (err instanceof Error && /Export cancelled/.test(err.message)) {
    // user-initiated abort; exit cleanly
    process.exit(0);
  }
  throw err;
}

Prevention

When it happens

Trigger: Interactive export into a non-empty directory where the operator declines the overwrite confirmation, or presses escape/ctrl-c at the @clack/prompts confirm.

Common situations: An operator realizes mid-export that the directory contains important files and bails out. A user fat-fingers 'no' on the prompt. Piping interrupted input that registers as a cancel.

Related errors


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