usebruno/bruno · warning · Error
path: ${filePath} already exists
Error message
path: ${filePath} already exists What it means
renderer:export-collection-postman refuses to overwrite an existing file when the overwrite flag is false (the default). If fs.existsSync(filePath) is true after the traversal check passes, the export is aborted to prevent silent clobber.
Source
Thrown at packages/bruno-electron/src/ipc/collection.js:2641
throw error;
}
});
ipcMain.handle('renderer:export-collection-postman', async (event, dirPath, fileName, content, overwrite = false) => {
try {
if (!dirPath || !fs.existsSync(dirPath)) {
throw new Error('Export location does not exist');
}
// ensure the resolved path is inside the export directory
const resolvedDir = path.resolve(dirPath);
const filePath = path.resolve(resolvedDir, fileName);
if (!filePath.startsWith(resolvedDir + path.sep) && filePath !== resolvedDir) {
throw new Error('Invalid file name');
}
if (!overwrite && fs.existsSync(filePath)) {
throw new Error(`path: ${filePath} already exists`);
}
await writeFile(filePath, content);
return { success: true, filePath };
} catch (error) {
return Promise.reject(error);
}
});
ipcMain.handle('renderer:is-bruno-collection-zip', async (event, zipFilePath) => {
try {
const zip = new AdmZip(zipFilePath);
const entries = zip.getEntries().map((e) => e.entryName);
return entries.some(
(name) =>
name === 'bruno.json'View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Pass overwrite=true if overwriting is intended.
- Choose a unique fileName (append a timestamp or counter).
- Delete the existing file before re-exporting.
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
if (!overwrite && fs.existsSync(filePath)) {
// append a counter or prompt the user
throw new Error(`path: ${filePath} already exists`);
} Try / catch
try {
await ipcRenderer.invoke('renderer:export-collection-postman', dirPath, fileName, content, overwrite);
} catch (err) {
if (/already exists/.test(err.message)) {
// prompt overwrite; retry with overwrite=true or a unique name
} else {
throw err;
}
} Prevention
- Surface an explicit overwrite confirmation in the UI before re-calling with overwrite=true.
- Auto-suffix duplicate exports with a timestamp to avoid the conflict.
When it happens
Trigger: Calling renderer:export-collection-postman with overwrite=false (or omitted) when filePath already exists on disk.
Common situations: Repeated exports to the same location; previous export left behind; user picked a name that already exists.
Related errors
- Export location does not exist
- path: ${newPath} already exists
- folder: ${collectionPath} already exists
- Collection path does not exist: ${collectionPathname}
- Collection path does not exist
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/cb62ac3107400fe1.
Report an issue: GitHub.