{"record":{"id":"a9c1ad5d516d057b","repo":"paperclipai/paperclip","slug":"output-directory-already-exists-and-is-not-empty","errorCode":null,"errorMessage":"Output directory already exists and is not empty: ${outputDir}","messagePattern":"Output directory already exists and is not empty: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/feedback.ts","lineNumber":563,"sourceCode":"\nfunction padRight(value: string, width: number): string {\n  return `${value}${\" \".repeat(Math.max(0, width - value.length))}`;\n}\n\nfunction defaultFeedbackExportDirName(): string {\n  const iso = new Date().toISOString().replace(/[-:]/g, \"\").replace(/\\.\\d{3}Z$/, \"Z\");\n  return `feedback-export-${iso}`;\n}\n\nasync function ensureEmptyOutputDirectory(outputDir: string): Promise<void> {\n  try {\n    const info = await stat(outputDir);\n    if (!info.isDirectory()) {\n      throw new Error(`Output path already exists and is not a directory: ${outputDir}`);\n    }\n    const entries = await readdir(outputDir);\n    if (entries.length > 0) {\n      throw new Error(`Output directory already exists and is not empty: ${outputDir}`);\n    }\n  } catch (error) {\n    const message = error instanceof Error ? error.message : \"\";\n    if (/ENOENT/.test(message)) {\n      await mkdir(outputDir, { recursive: true });\n      return;\n    }\n    throw error;\n  }\n}\n\nasync function collectJsonFilesForArchive(\n  outputDir: string,\n  relativePaths: string[],\n): Promise<Record<string, string>> {\n  const files: Record<string, string> = {};\n  for (const relativePath of relativePaths) {\n    const normalized = relativePath.replace(/\\\\/g, \"/\");","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/feedback.ts#L545-L581","documentation":"The feedback export output directory exists and contains entries, so the empty-directory guard refuses to overwrite previous export contents.","triggerScenarios":"Thrown at cli/src/commands/client/feedback.ts:563 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose an empty/non-existent output directory, or clear the existing one."],"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"}