paperclipai/paperclip · error · Error
Output path already exists and is not a directory
Error message
Output path already exists and is not a directory: ${outputDir} What it means
ensureEmptyOutputDirectory stat'ed the feedback export output path and found a non-directory entry, so the export bundle cannot be written there.
Solutions
- Choose a different output path, or remove the existing file at that path.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cli/src/commands/client/feedback.ts:559 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/f1934b6f91854f3a.
Report an issue: GitHub.
Appendix: source
Thrown at cli/src/commands/client/feedback.ts:559
function horizontalRule(): string {
return pc.dim("-".repeat(72));
}
function padRight(value: string, width: number): string {
return `${value}${" ".repeat(Math.max(0, width - value.length))}`;
}
function defaultFeedbackExportDirName(): string {
const iso = new Date().toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
return `feedback-export-${iso}`;
}
async function ensureEmptyOutputDirectory(outputDir: string): Promise<void> {
try {
const info = await stat(outputDir);
if (!info.isDirectory()) {
throw new Error(`Output path already exists and is not a directory: ${outputDir}`);
}
const entries = await readdir(outputDir);
if (entries.length > 0) {
throw new Error(`Output directory already exists and is not empty: ${outputDir}`);
}
} catch (error) {
const message = error instanceof Error ? error.message : "";
if (/ENOENT/.test(message)) {
await mkdir(outputDir, { recursive: true });
return;
}
throw error;
}
}
async function collectJsonFilesForArchive(
outputDir: string,
relativePaths: string[],View on GitHub (pinned to 120ae5428f)