usebruno/bruno · warning · Error
${filename} file does not exist
Error message
${filename} file does not exist What it means
Thrown by the 'renderer:delete-dotenv-file' IPC handler when fs.existsSync() reports the resolved .env path is absent. Bruno deletes collection-scoped dotenv files (e.g. .env, .env.local) from disk via this handler, and it refuses to call fs.unlinkSync on a missing file. The filename is first validated by isValidDotEnvFilename (must be '.env' or start with '.env.'), so this error means the name was valid but the file is gone.
Source
Thrown at packages/bruno-electron/src/ipc/collection.js:928
} catch (error) {
console.error('Error creating .env file:', error);
return Promise.reject(error);
}
});
// Delete .env file for collection
ipcMain.handle('renderer:delete-dotenv-file', async (event, collectionPathname, filename = '.env') => {
try {
if (!isValidDotEnvFilename(filename)) {
throw new Error('Invalid .env filename');
}
validatePathIsInsideCollection(collectionPathname);
const dotEnvPath = path.join(collectionPathname, filename);
if (!fs.existsSync(dotEnvPath)) {
throw new Error(`${filename} file does not exist`);
}
fs.unlinkSync(dotEnvPath);
return { success: true };
} catch (error) {
console.error('Error deleting .env file:', error);
return Promise.reject(error);
}
});
// update environment color
ipcMain.handle('renderer:update-environment-color', async (event, collectionPathname, environmentName, color) => {
try {
const format = getCollectionFormat(collectionPathname);
const envFilePath = resolveEnvironmentFilePath(collectionPathname, environmentName, format);
if (!fs.existsSync(envFilePath)) {View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Verify the file still exists with fs.existsSync(path.join(collectionPathname, filename)) before issuing delete, and treat missing-file as success (idempotent delete).
- Refresh the collection/environment panel so the UI stops offering delete for files that no longer exist.
- Check that collectionPathname points at the currently loaded collection and not a stale/copied path.
Example fix
// before
await window.Ipc.invoke('renderer:delete-dotenv-file', collectionPathname, filename);
// after
const fs = window.Ipc; // renderer has no fs; do existence check via a stat IPC or just make delete idempotent in the handler:
// in collection.js handler:
if (!fs.existsSync(dotEnvPath)) {
return { success: true, alreadyAbsent: true };
} Defensive patterns
Strategy: validation
Validate before calling
// renderer side: confirm file exists before issuing delete
const fullPath = path.join(collectionPathname, filename);
const exists = await window.ipc.invoke('main:path-exists', fullPath);
if (!exists) return { skipped: true, reason: 'already-absent' };
await window.Ipc.invoke('renderer:delete-dotenv-file', collectionPathname, filename); Type guard
function isValidDotEnvName(filename: unknown): filename is string {
return typeof filename === 'string'
&& (filename === '.env' || (/^\.env\.[a-zA-Z0-9._-]+$/.test(filename)));
} Try / catch
try {
await window.Ipc.invoke('renderer:delete-dotenv-file', collectionPathname, filename);
} catch (e) {
if (String(e?.message).includes('does not exist')) return; // idempotent
throw e;
} Prevention
- Treat 'file does not exist' on delete as success (idempotent) in the renderer.
- Disable the delete control when the file is known to be absent.
- Refresh the collection panel after external filesystem changes.
When it happens
Trigger: Calling ipcRenderer.invoke('renderer:delete-dotenv-file', collectionPathname, filename) where filename passes isValidDotEnvFilename but path.join(collectionPathname, filename) does not exist on disk. Happens when the UI issues a delete after the file was already removed externally, after a rename, or when the collection directory was moved.
Common situations: User deleted the .env file outside Bruno (editor/terminal), the collection was relocated, a sync conflict removed it, or a duplicate delete request fired (double-click, stale UI state).
Related errors
- ${filename} file already exists
- Export path: ${filePath} is not an existing directory
- path: ${itemPath} does not exist
- path: ${oldPath} does not exist
- folder: ${folderPath} does not exist
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/9622c1b3585eed6d.
Report an issue: GitHub.