{"record":{"id":"1e1e4d291b6ef181","repo":"usebruno/bruno","slug":"path-pathname-already-exists","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/apiSpec.js","lineNumber":46,"sourceCode":"    } catch (error) {\n      return Promise.reject(error);\n    }\n  });\n\n  ipcMain.handle('renderer:create-api-spec', async (event, apiSpecName, apiSpecLocation, content = '', workspacePath = null) => {\n    try {\n      if (typeof apiSpecName !== 'string' || apiSpecName !== path.basename(apiSpecName)) {\n        throw new Error(`api spec: ${apiSpecName} is not a valid filename`);\n      }\n      validateApiSpec(apiSpecName);\n\n      if (typeof apiSpecLocation !== 'string' || !isDirectory(apiSpecLocation)) {\n        throw new Error(`path: ${apiSpecLocation} is not an existing directory`);\n      }\n\n      let pathname = path.join(apiSpecLocation, apiSpecName);\n      if (fs.existsSync(pathname)) {\n        throw new Error(`path: ${pathname} already exists`);\n      }\n      await writeFile(pathname, content);\n      openApiSpec(mainWindow, watcher, pathname, { workspacePath });\n    } catch (error) {\n      return Promise.reject(error);\n    }\n  });\n\n  ipcMain.handle('renderer:remove-api-spec', async (event, pathname, workspacePath = null) => {\n    try {\n      if (watcher && mainWindow) {\n        watcher.removeWatcher(pathname, mainWindow);\n        removeApiSpecUid(pathname);\n\n        if (workspacePath) {\n          const workspaceFilePath = path.join(workspacePath, 'workspace.yml');\n\n          if (fs.existsSync(workspaceFilePath)) {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/apiSpec.js#L28-L64","documentation":"Error \"path: ${pathname} already exists\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-electron/src/ipc/apiSpec.js:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a different name/location, or remove the existing file first."],"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"}