usebruno/bruno · error · Error

ZIP file does not exist

Error message

ZIP file does not exist

What it means

renderer:import-collection-zip validates zipFilePath with fs.existsSync before extraction. Throws before creating the temp directory, so no partial state is left behind.

Solutions

  1. Verify the zip exists at the moment of import (re-stat just before calling).
  2. Re-prompt the user to pick the file if it has been removed.
  3. Copy the selected zip into a process-owned temp location immediately on selection.
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
if (!zipFilePath || !fs.existsSync(zipFilePath)) {
  throw new Error('ZIP file does not exist');
}

Try / catch

try {
  await ipcRenderer.invoke('renderer:import-collection-zip', zipFilePath, collectionLocation);
} catch (err) {
  if (/ZIP file does not exist/.test(err.message)) {
    // re-prompt the user to pick the zip
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Calling renderer:import-collection-zip with a zipFilePath that does not exist on disk at call time.

Common situations: Temp file selected in a dialog was cleaned by the OS between selection and import; network drive hiccup; path computed from stale state; user moved/deleted the zip after picking it.

Related errors


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

Appendix: source

Thrown at packages/bruno-electron/src/ipc/collection.js:2672

      const zip = new AdmZip(zipFilePath);
      const entries = zip.getEntries().map((e) => e.entryName);

      return entries.some(
        (name) =>
          name === 'bruno.json'
          || name === 'opencollection.yml'
          || /^[^/]+\/bruno\.json$/.test(name)
          || /^[^/]+\/opencollection\.yml$/.test(name)
      );
    } catch {
      return false;
    }
  });

  ipcMain.handle('renderer:import-collection-zip', async (event, zipFilePath, collectionLocation) => {
    try {
      if (!fs.existsSync(zipFilePath)) {
        throw new Error('ZIP file does not exist');
      }

      if (!collectionLocation || !fs.existsSync(collectionLocation)) {
        throw new Error('Collection location does not exist');
      }

      const tempDir = path.join(os.tmpdir(), `bruno_zip_import_${Date.now()}`);
      await fsExtra.ensureDir(tempDir);

      // Validates that no symlinks point outside the base directory
      const validateNoExternalSymlinks = (dir, baseDir) => {
        const entries = fs.readdirSync(dir, { withFileTypes: true });
        for (const entry of entries) {
          const fullPath = path.join(dir, entry.name);
          const stat = fs.lstatSync(fullPath);

          if (stat.isSymbolicLink()) {
            const linkTarget = fs.readlinkSync(fullPath);

View on GitHub (pinned to 9bdd81c7bd)