{"record":{"id":"f1934b6f91854f3a","repo":"paperclipai/paperclip","slug":"output-path-already-exists-and-is-not-a-directory","errorCode":null,"errorMessage":"Output path already exists and is not a directory: ${outputDir}","messagePattern":"Output path already exists and is not a directory: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/feedback.ts","lineNumber":559,"sourceCode":"\nfunction horizontalRule(): string {\n  return pc.dim(\"-\".repeat(72));\n}\n\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[],","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/feedback.ts#L541-L577","documentation":"ensureEmptyOutputDirectory stat'ed the feedback export output path and found a non-directory entry, so the export bundle cannot be written there.","triggerScenarios":"Thrown at cli/src/commands/client/feedback.ts:559 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a different output path, or remove the existing file at that path."],"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"}