usebruno/bruno · error · Error

Source path: ${sourcePathname} does not exist

Error message

Source path: ${sourcePathname} does not exist

What it means

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.

Source

Thrown at packages/bruno-electron/src/ipc/collection.js:587

        throw new Error(`path: ${pathname} does not exist`);
      }

      validatePathIsInsideCollection(pathname);

      // Sync example UIDs cache to maintain consistency when examples are added/deleted/reordered
      syncExampleUidsCache(pathname, request.examples);

      const content = await stringifyRequestViaWorker(request, { format });
      await writeFile(pathname, content);
    } catch (error) {
      return Promise.reject(error);
    }
  });

  ipcMain.handle('renderer:save-transient-request', async (event, { sourcePathname, targetDirname, targetFilename, request, format, sourceFormat }) => {
    try {
      if (!fs.existsSync(sourcePathname)) {
        throw new Error(`Source path: ${sourcePathname} does not exist`);
      }

      if (!fs.existsSync(targetDirname)) {
        throw new Error(`Target directory: ${targetDirname} does not exist`);
      }

      validatePathIsInsideCollection(targetDirname);

      const collectionPath = findCollectionPathByItemPath(targetDirname);
      if (!collectionPath) {
        throw new Error('Could not determine collection for target directory');
      }
      const targetFormat = getCollectionFormat(collectionPath);

      const filename = targetFilename || path.basename(sourcePathname);
      const filenameWithoutExt = filename.replace(/\.(bru|yml)$/, '');
      const finalFilename = `${filenameWithoutExt}.${targetFormat}`;
      const targetPathname = path.join(targetDirname, finalFilename);

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Verify sourcePathname exists before invoking save-transient-request; if missing, reconstruct the request object and use save-new-request on the target instead.
  2. Increase temp file retention or avoid clearing the scratch dir while tabs are open.
  3. Pass the full request body so the handler can fall back to creating from the object rather than reading the source file.

Example fix

// before
await window.ipcRenderer.invoke('renderer:save-transient-request', { sourcePathname, targetDirname, targetFilename, request, format, sourceFormat });

// after
const srcExists = await window.ipcRenderer.invoke('renderer:file-exists', sourcePathname);
if (!srcExists) {
  const targetPath = path.join(targetDirname, targetFilename);
  await window.ipcRenderer.invoke('renderer:save-new-request', targetPath, { ...request, filename: targetFilename });
} else {
  await window.ipcRenderer.invoke('renderer:save-transient-request', { sourcePathname, targetDirname, targetFilename, request, format, sourceFormat });
}
Defensive patterns

Strategy: validation

Validate before calling

const srcExists = await window.ipcRenderer.invoke('renderer:file-exists', sourcePathname);
if (!srcExists) {
  // reconstruct from the in-memory request and use save-new-request on the target
}

Try / catch

try {
  await window.ipcRenderer.invoke('renderer:save-transient-request', payload);
} catch (e) {
  if (/Source path:.+does not exist/.test(e.message)) {
    await saveAsNewRequest(payload.targetDirname, payload.targetFilename, payload.request);
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13). Data as JSON: /api/errors/56ebaf9f36df197f. Report an issue: GitHub.