paperclipai/paperclip · error · Error

Export output directory

Error message

Export output directory ${root} already contains files. Re-run interactively, pass --force, or choose an empty directory.

What it means

The export output directory is non-empty, --force was not passed, and the process has no TTY, so the overwrite-confirmation guard aborts rather than silently clobber existing files.

Solutions

  1. Pass --force to overwrite, or choose an empty output directory.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/client/company.ts:1255 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/7973bc5b4692169a. Report an issue: GitHub.

Appendix: source

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

  opts: { force?: boolean } = {},
): Promise<void> {
  const root = path.resolve(outDir);
  const stats = await stat(root).catch(() => null);
  if (!stats) return;
  if (!stats.isDirectory()) {
    throw new Error(`Export output path ${root} exists and is not a directory.`);
  }

  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[],

View on GitHub (pinned to 120ae5428f)