{"record":{"id":"7973bc5b4692169a","repo":"paperclipai/paperclip","slug":"export-output-directory-root-already-contains-f","errorCode":null,"errorMessage":"Export output directory ${root} already contains files. Re-run interactively, pass --force, or choose an empty directory.","messagePattern":"Export output directory (.+?) already contains files\\. Re-run interactively, pass --force, or choose an empty directory\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/company.ts","lineNumber":1255,"sourceCode":"  opts: { force?: boolean } = {},\n): Promise<void> {\n  const root = path.resolve(outDir);\n  const stats = await stat(root).catch(() => null);\n  if (!stats) return;\n  if (!stats.isDirectory()) {\n    throw new Error(`Export output path ${root} exists and is not a directory.`);\n  }\n\n  const entries = await readdir(root);\n  if (entries.length === 0) return;\n\n  // --force skips the guard for non-interactive/automated callers (e.g. the\n  // nightly backup routine, which exports into a git clone that legitimately\n  // still holds .git and BACKUP-README.md after cleaning tracked content).\n  if (opts.force) return;\n\n  if (!process.stdin.isTTY || !process.stdout.isTTY) {\n    throw new Error(`Export output directory ${root} already contains files. Re-run interactively, pass --force, or choose an empty directory.`);\n  }\n\n  const confirmed = await p.confirm({\n    message: `Overwrite existing files in ${root}?`,\n    initialValue: false,\n  });\n\n  if (p.isCancel(confirmed) || !confirmed) {\n    throw new Error(\"Export cancelled.\");\n  }\n}\n\nfunction matchesPrefix(company: Company, selector: string): boolean {\n  return company.issuePrefix.toUpperCase() === selector.toUpperCase();\n}\n\nexport function resolveCompanyForDeletion(\n  companies: Company[],","sourceCodeStart":1237,"sourceCodeEnd":1273,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/company.ts#L1237-L1273","documentation":"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.","triggerScenarios":"Thrown at cli/src/commands/client/company.ts:1255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass --force to overwrite, or choose an empty output directory."],"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"}