{"record":{"id":"cfc985d2f7aed7e5","repo":"usebruno/bruno","slug":"path-pathname-already-exists-cfc985","errorCode":null,"errorMessage":"path: ${pathname} already exists","messagePattern":"path: (.+?) already exists","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":542,"sourceCode":"      const format = getCollectionFormat(collectionPathname);\n      const filename = format === 'yml' ? 'opencollection.yml' : 'collection.bru';\n      const content = await stringifyCollection(collectionRoot, brunoConfig, { format });\n\n      const filePath = path.join(collectionPathname, filename);\n      const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : null;\n      if (content === existing) return; // skip write if content unchanged\n      await writeFile(filePath, content);\n    } catch (error) {\n      console.error('Error in save-collection-root:', error);\n      return Promise.reject(error);\n    }\n  });\n\n  // new request\n  ipcMain.handle('renderer:new-request', async (event, pathname, request) => {\n    try {\n      if (fs.existsSync(pathname)) {\n        throw new Error(`path: ${pathname} already exists`);\n      }\n\n      const collectionPath = findCollectionPathByItemPath(pathname);\n      if (!collectionPath) {\n        throw new Error('Collection not found for the given pathname');\n      }\n      const format = getCollectionFormat(collectionPath);\n\n      // For the actual filename part, we want to be strict\n      const baseFilename = request?.filename?.replace(`.${format}`, '');\n      if (!validateName(baseFilename)) {\n        throw new Error(`${request.filename} is not a valid filename`);\n      }\n      validatePathIsInsideCollection(pathname);\n\n      const content = await stringifyRequestViaWorker(request, { format });\n      await writeFile(pathname, content);\n    } catch (error) {","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L524-L560","documentation":"Error \"path: ${pathname} already exists\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-electron/src/ipc/collection.js:542 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a different name or location, or delete/rename the existing item."],"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"}