{"record":{"id":"a513f02810118fe4","repo":"usebruno/bruno","slug":"export-location-does-not-exist","errorCode":null,"errorMessage":"Export location does not exist","messagePattern":"Export location does not exist","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":2630,"sourceCode":"              archive.file(fullPath, { name: entryArchivePath });\n            }\n          }\n        };\n\n        addDirectoryToArchive(collectionPath, '');\n        archive.finalize();\n      });\n\n      return { success: true, filePath };\n    } catch (error) {\n      throw error;\n    }\n  });\n\n  ipcMain.handle('renderer:export-collection-postman', async (event, dirPath, fileName, content, overwrite = false) => {\n    try {\n      if (!dirPath || !fs.existsSync(dirPath)) {\n        throw new Error('Export location does not exist');\n      }\n\n      // ensure the resolved path is inside the export directory\n      const resolvedDir = path.resolve(dirPath);\n      const filePath = path.resolve(resolvedDir, fileName);\n      if (!filePath.startsWith(resolvedDir + path.sep) && filePath !== resolvedDir) {\n        throw new Error('Invalid file name');\n      }\n\n      if (!overwrite && fs.existsSync(filePath)) {\n        throw new Error(`path: ${filePath} already exists`);\n      }\n\n      await writeFile(filePath, content);\n\n      return { success: true, filePath };\n    } catch (error) {\n      return Promise.reject(error);","sourceCodeStart":2612,"sourceCodeEnd":2648,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L2612-L2648","documentation":"renderer:export-collection-postman validates dirPath is truthy and exists on disk. Thrown before any path resolution, guarding the export target.","triggerScenarios":"Calling renderer:export-collection-postman with a dirPath that is empty, null, or not present on disk.","commonSituations":"User-selected export directory deleted or on unmounted removable media; default export dir unset.","solutions":["Pick an existing directory in the save dialog before exporting.","Create the directory (fs.mkdirSync recursive) before invoking.","Default to app.getPath('desktop') or os.homedir() when no path is chosen."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const fs = require('fs');\nif (!dirPath || !fs.existsSync(dirPath)) {\n  fs.mkdirSync(dirPath, { recursive: true }); // or re-prompt\n}","typeGuard":null,"tryCatchPattern":"try {\n  await ipcRenderer.invoke('renderer:export-collection-postman', dirPath, fileName, content, overwrite);\n} catch (err) {\n  if (/Export location does not exist/.test(err.message)) {\n    // ask the user to pick a valid directory\n  } else {\n    throw err;\n  }\n}","preventionTips":["Default to a known-writable location (app.getPath('desktop')) when no dir is chosen.","Validate the picked directory exists at click time."],"tags":["ipc","export","postman","filesystem","validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}