{"record":{"id":"f0d7dc94747e80a2","repo":"usebruno/bruno","slug":"path-pathname-does-not-exist","errorCode":null,"errorMessage":"path: ${pathname} does not exist","messagePattern":"path: (.+?) does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":569,"sourceCode":"      // 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) {\n      return Promise.reject(error);\n    }\n  });\n\n  // save request\n  ipcMain.handle('renderer:save-request', async (event, pathname, request, format) => {\n    try {\n      if (!fs.existsSync(pathname)) {\n        throw new Error(`path: ${pathname} does not exist`);\n      }\n\n      validatePathIsInsideCollection(pathname);\n\n      // Sync example UIDs cache to maintain consistency when examples are added/deleted/reordered\n      syncExampleUidsCache(pathname, request.examples);\n\n      const content = await stringifyRequestViaWorker(request, { format });\n      await writeFile(pathname, content);\n    } catch (error) {\n      return Promise.reject(error);\n    }\n  });\n\n  ipcMain.handle('renderer:save-transient-request', async (event, { sourcePathname, targetDirname, targetFilename, request, format, sourceFormat }) => {\n    try {\n      if (!fs.existsSync(sourcePathname)) {\n        throw new Error(`Source path: ${sourcePathname} does not exist`);","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L551-L587","documentation":"Thrown by the 'renderer:save-request' IPC handler (which overwrites an existing request file) when fs.existsSync(pathname) returns false. save-request is not a create operation; it assumes the .bru/.yml file already exists on disk. The path is also required to live inside an open collection (validatePathIsInsideCollection runs next).","triggerScenarios":"Invoking 'renderer:save-request' for a file that was deleted from disk, moved, never written, or whose pathname is misspelled. Also hit in a race where another process/user deletes the file between the renderer opening it and saving.","commonSituations":"The request was removed externally (git checkout, manual delete, sync conflict) but the UI still shows it. A save fired against a freshly renamed file using the old path. Two Bruno instances editing the same collection.","solutions":["Confirm the file still exists before saving (stat the path or re-read the collection tree).","If the file is gone, route through 'renderer:save-new-request' instead, which creates the file.","Reload the collection in the UI so stale pathnames are refreshed before retrying.","Ensure no external tool (watcher, git, cloud sync) is deleting request files under the collection."],"exampleFix":"// before\nawait window.ipcRenderer.invoke('renderer:save-request', pathname, request, format);\n\n// after\nconst exists = await window.ipcRenderer.invoke('renderer:file-exists', pathname);\nif (!exists) {\n  await window.ipcRenderer.invoke('renderer:save-new-request', pathname, { ...request, filename: path.basename(pathname) });\n} else {\n  await window.ipcRenderer.invoke('renderer:save-request', pathname, request, format);\n}","handlingStrategy":"validation","validationCode":"const exists = await window.ipcRenderer.invoke('renderer:file-exists', pathname);\nif (!exists) {\n  // file is gone — route to save-new-request or refresh the tree\n}","typeGuard":null,"tryCatchPattern":"try {\n  await window.ipcRenderer.invoke('renderer:save-request', pathname, request, format);\n} catch (e) {\n  if (/does not exist/.test(e.message)) {\n    await refreshCollectionTree();\n    // optionally recreate via save-new-request\n  } else throw e;\n}","preventionTips":["Refresh the collection tree after external filesystem changes (git pull, sync) before saving.","Detect that the backing file is missing when a tab gains focus and offer to recreate it.","Avoid running two Bruno instances that edit the same collection concurrently."],"tags":["ipc","filesystem","request","race-condition","bruno"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}