{"record":{"id":"b2e715944bb4afd7","repo":"usebruno/bruno","slug":"zip-file-does-not-exist","errorCode":null,"errorMessage":"ZIP file does not exist","messagePattern":"ZIP file does not exist","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":2672,"sourceCode":"      const zip = new AdmZip(zipFilePath);\n      const entries = zip.getEntries().map((e) => e.entryName);\n\n      return entries.some(\n        (name) =>\n          name === 'bruno.json'\n          || name === 'opencollection.yml'\n          || /^[^/]+\\/bruno\\.json$/.test(name)\n          || /^[^/]+\\/opencollection\\.yml$/.test(name)\n      );\n    } catch {\n      return false;\n    }\n  });\n\n  ipcMain.handle('renderer:import-collection-zip', async (event, zipFilePath, collectionLocation) => {\n    try {\n      if (!fs.existsSync(zipFilePath)) {\n        throw new Error('ZIP file does not exist');\n      }\n\n      if (!collectionLocation || !fs.existsSync(collectionLocation)) {\n        throw new Error('Collection location does not exist');\n      }\n\n      const tempDir = path.join(os.tmpdir(), `bruno_zip_import_${Date.now()}`);\n      await fsExtra.ensureDir(tempDir);\n\n      // Validates that no symlinks point outside the base directory\n      const validateNoExternalSymlinks = (dir, baseDir) => {\n        const entries = fs.readdirSync(dir, { withFileTypes: true });\n        for (const entry of entries) {\n          const fullPath = path.join(dir, entry.name);\n          const stat = fs.lstatSync(fullPath);\n\n          if (stat.isSymbolicLink()) {\n            const linkTarget = fs.readlinkSync(fullPath);","sourceCodeStart":2654,"sourceCodeEnd":2690,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L2654-L2690","documentation":"renderer:import-collection-zip validates zipFilePath with fs.existsSync before extraction. Throws before creating the temp directory, so no partial state is left behind.","triggerScenarios":"Calling renderer:import-collection-zip with a zipFilePath that does not exist on disk at call time.","commonSituations":"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.","solutions":["Verify the zip exists at the moment of import (re-stat just before calling).","Re-prompt the user to pick the file if it has been removed.","Copy the selected zip into a process-owned temp location immediately on selection."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const fs = require('fs');\nif (!zipFilePath || !fs.existsSync(zipFilePath)) {\n  throw new Error('ZIP file does not exist');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await ipcRenderer.invoke('renderer:import-collection-zip', zipFilePath, collectionLocation);\n} catch (err) {\n  if (/ZIP file does not exist/.test(err.message)) {\n    // re-prompt the user to pick the zip\n  } else {\n    throw err;\n  }\n}","preventionTips":["Copy the selected zip into a process-owned temp location immediately on selection.","Re-stat the file just before invoking; tmp cleanup can reap it between selection and import."],"tags":["ipc","import","zip","filesystem","validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}