usebruno/bruno · error · Error

path: ${pathname} does not exist

Error message

path: ${pathname} does not exist

What it means

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).

Source

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

      // For the actual filename part, we want to be strict
      const baseFilename = request?.filename?.replace(`.${format}`, '');
      if (!validateName(baseFilename)) {
        throw new Error(`${request.filename} is not a valid filename`);
      }
      validatePathIsInsideCollection(pathname);

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

  // save request
  ipcMain.handle('renderer:save-request', async (event, pathname, request, format) => {
    try {
      if (!fs.existsSync(pathname)) {
        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`);

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Confirm the file still exists before saving (stat the path or re-read the collection tree).
  2. If the file is gone, route through 'renderer:save-new-request' instead, which creates the file.
  3. Reload the collection in the UI so stale pathnames are refreshed before retrying.
  4. Ensure no external tool (watcher, git, cloud sync) is deleting request files under the collection.

Example fix

// before
await window.ipcRenderer.invoke('renderer:save-request', pathname, request, format);

// after
const exists = await window.ipcRenderer.invoke('renderer:file-exists', pathname);
if (!exists) {
  await window.ipcRenderer.invoke('renderer:save-new-request', pathname, { ...request, filename: path.basename(pathname) });
} else {
  await window.ipcRenderer.invoke('renderer:save-request', pathname, request, format);
}
Defensive patterns

Strategy: validation

Validate before calling

const exists = await window.ipcRenderer.invoke('renderer:file-exists', pathname);
if (!exists) {
  // file is gone — route to save-new-request or refresh the tree
}

Try / catch

try {
  await window.ipcRenderer.invoke('renderer:save-request', pathname, request, format);
} catch (e) {
  if (/does not exist/.test(e.message)) {
    await refreshCollectionTree();
    // optionally recreate via save-new-request
  } else throw e;
}

Prevention

When it happens

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

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

Related errors


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