usebruno/bruno · warning · Error

${filename} file does not exist

Error message

${filename} file does not exist

What it means

In `renderer:delete-workspace-dotenv-file`, after validation, `fs.existsSync(dotEnvPath)` must be true before `fs.unlinkSync`. If the file isn't there the handler refuses rather than performing a silent no-op.

Source

Thrown at packages/bruno-electron/src/ipc/global-environments.js:246

      return Promise.reject(error);
    }
  });

  // Delete workspace .env file
  ipcMain.handle('renderer:delete-workspace-dotenv-file', async (event, { workspacePath, filename = '.env' }) => {
    try {
      if (!workspacePath) {
        throw new Error('Workspace path is required');
      }

      if (!isValidDotEnvFilename(filename)) {
        throw new Error('Invalid .env filename');
      }

      const dotEnvPath = path.join(workspacePath, 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 workspace .env file:', error);
      return Promise.reject(error);
    }
  });

  ipcMain.handle('renderer:update-global-environment-color', async (event, { environmentUid, color, workspacePath }) => {
    try {
      if (workspacePath && workspaceEnvironmentsManager) {
        return await workspaceEnvironmentsManager.updateGlobalEnvironmentColorByPath(workspacePath, { environmentUid, color });
      }

      globalEnvironmentsStore.updateGlobalEnvironmentColor({ environmentUid, color });

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Refresh the file list and only retry if the file is present.
  2. Treat the error as success if the goal is simply 'ensure gone'.
  3. Guard the call with an existence check and skip when already absent.

Example fix

// before
await invoke('renderer:delete-workspace-dotenv-file', { workspacePath, filename: '.env' }); // throws if missing
// after - idempotent delete
if (fs.existsSync(path.join(workspacePath, '.env'))) {
  await invoke('renderer:delete-workspace-dotenv-file', { workspacePath, filename: '.env' });
}
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs'), path = require('path');
const exists = (workspacePath, filename) => fs.existsSync(path.join(workspacePath, filename));

Try / catch

try {
  await invoke('renderer:delete-workspace-dotenv-file', { workspacePath, filename });
} catch (e) {
  if (!/does not exist/i.test(e.message)) throw e; // idempotent: treat missing as success
}

Prevention

When it happens

Trigger: Deleting a file that was removed externally; double-delete; the UI file list is out of sync with disk.

Common situations: The file was deleted outside Bruno; a previous delete already ran; refresh lag in the UI.

Related errors


AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13). Data as JSON: /api/errors/4a9b831c7c1bc538. Report an issue: GitHub.