usebruno/bruno · error · Error

Collection location does not exist

Error message

Collection location does not exist

What it means

renderer:import-collection-zip validates collectionLocation (the destination directory) is truthy and exists on disk. Throws before creating the extraction temp dir, preventing import into a missing target.

Source

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

        (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);
            const resolvedTarget = path.resolve(path.dirname(fullPath), linkTarget);
            if (!resolvedTarget.startsWith(baseDir + path.sep) && resolvedTarget !== baseDir) {
              throw new Error(`Security error: Symlink "${entry.name}" points outside extraction directory`);
            }

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Pick an existing directory as the import destination.
  2. Create the destination directory (fs.mkdirSync recursive) before invoking.
  3. Default to a known-writable location (e.g. the workspace root) when none is chosen.
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
if (!collectionLocation || !fs.existsSync(collectionLocation)) {
  fs.mkdirSync(collectionLocation, { recursive: true }); // or re-prompt
}

Try / catch

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

Prevention

When it happens

Trigger: Calling renderer:import-collection-zip with a collectionLocation that is empty or not present on disk.

Common situations: User-selected import destination deleted between selection and confirmation; removable media unmounted; path typed manually and incorrect.

Related errors


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