{"record":{"id":"b828d83b11c50880","repo":"usebruno/bruno","slug":"collection-dirpath-already-exists-and-is-not-e","errorCode":null,"errorMessage":"collection: ${dirPath} already exists and is not empty","messagePattern":"collection: (.+?) already exists and is not empty","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":204,"sourceCode":"  }\n\n  return envFilePath;\n};\n\nconst registerRendererEventHandlers = (mainWindow, watcher) => {\n  // create collection\n  ipcMain.handle(\n    'renderer:create-collection',\n    async (event, collectionName, collectionFolderName, collectionLocation, options = {}) => {\n      try {\n        const format = options.format || DEFAULT_COLLECTION_FORMAT;\n        collectionFolderName = sanitizeName(collectionFolderName);\n        const dirPath = path.join(collectionLocation, collectionFolderName);\n        if (fs.existsSync(dirPath)) {\n          const files = fs.readdirSync(dirPath);\n\n          if (files.length > 0) {\n            throw new Error(`collection: ${dirPath} already exists and is not empty`);\n          }\n        }\n\n        if (!validateName(path.basename(dirPath))) {\n          throw new Error(`collection: invalid pathname - ${dirPath}`);\n        }\n\n        if (!fs.existsSync(dirPath)) {\n          await createDirectory(dirPath);\n        }\n\n        const uid = generateUidBasedOnHash(dirPath);\n        let brunoConfig = {\n          version: '1',\n          name: collectionName,\n          type: 'collection',\n          ignore: ['node_modules', '.git']\n        };","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L186-L222","documentation":"Error \"collection: ${dirPath} already exists and is not empty\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-electron/src/ipc/collection.js:204 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose an empty or new directory for the collection.","Empty the target directory if it is safe to do so."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}