{"record":{"id":"56ebaf9f36df197f","repo":"usebruno/bruno","slug":"source-path-sourcepathname-does-not-exist","errorCode":null,"errorMessage":"Source path: ${sourcePathname} does not exist","messagePattern":"Source path: (.+?) does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":587,"sourceCode":"        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`);\n      }\n\n      if (!fs.existsSync(targetDirname)) {\n        throw new Error(`Target directory: ${targetDirname} does not exist`);\n      }\n\n      validatePathIsInsideCollection(targetDirname);\n\n      const collectionPath = findCollectionPathByItemPath(targetDirname);\n      if (!collectionPath) {\n        throw new Error('Could not determine collection for target directory');\n      }\n      const targetFormat = getCollectionFormat(collectionPath);\n\n      const filename = targetFilename || path.basename(sourcePathname);\n      const filenameWithoutExt = filename.replace(/\\.(bru|yml)$/, '');\n      const finalFilename = `${filenameWithoutExt}.${targetFormat}`;\n      const targetPathname = path.join(targetDirname, finalFilename);","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L569-L605","documentation":"Thrown by 'renderer:save-transient-request' when the source file (sourcePathname — the temporary .bru/.yml backing the unsaved request) does not exist on disk. Transient requests are backed by a real temp file; this handler converts/moves it into a target collection directory, so it first verifies the source still exists.","triggerScenarios":"Saving a transient/scratch request whose temp file was cleaned up (OS temp rotation, scratch collection cleared, app restart purged temp). Passing a sourcePathname that was never created. The temp dir was wiped between the request being opened and being saved into a collection.","commonSituations":"User keeps an unsaved tab open across an app/session restart. Scratch pad collection temp files garbage-collected. Manual cleanup of the Bruno temp directory.","solutions":["Verify sourcePathname exists before invoking save-transient-request; if missing, reconstruct the request object and use save-new-request on the target instead.","Increase temp file retention or avoid clearing the scratch dir while tabs are open.","Pass the full request body so the handler can fall back to creating from the object rather than reading the source file."],"exampleFix":"// before\nawait window.ipcRenderer.invoke('renderer:save-transient-request', { sourcePathname, targetDirname, targetFilename, request, format, sourceFormat });\n\n// after\nconst srcExists = await window.ipcRenderer.invoke('renderer:file-exists', sourcePathname);\nif (!srcExists) {\n  const targetPath = path.join(targetDirname, targetFilename);\n  await window.ipcRenderer.invoke('renderer:save-new-request', targetPath, { ...request, filename: targetFilename });\n} else {\n  await window.ipcRenderer.invoke('renderer:save-transient-request', { sourcePathname, targetDirname, targetFilename, request, format, sourceFormat });\n}","handlingStrategy":"validation","validationCode":"const srcExists = await window.ipcRenderer.invoke('renderer:file-exists', sourcePathname);\nif (!srcExists) {\n  // reconstruct from the in-memory request and use save-new-request on the target\n}","typeGuard":null,"tryCatchPattern":"try {\n  await window.ipcRenderer.invoke('renderer:save-transient-request', payload);\n} catch (e) {\n  if (/Source path:.+does not exist/.test(e.message)) {\n    await saveAsNewRequest(payload.targetDirname, payload.targetFilename, payload.request);\n  } else throw e;\n}","preventionTips":["Keep transient request bodies in memory so they can be re-materialized if the temp file is lost.","Avoid clearing the scratch/temp directory while unsaved tabs are open.","Persist transient tabs to disk on a debounce so they survive restarts."],"tags":["ipc","filesystem","request","temp-files","bruno"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}