usebruno/bruno · error · Error

path: ${oldPath} does not exist

Error message

path: ${oldPath} does not exist

What it means

Thrown by 'renderer:rename-item-filename' when fs.existsSync(oldPath) is false after the inside-collection validation. The handler changes the on-disk filename of an item, so the source must already exist.

Source

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

      jsonData.name = newName;
      const content = stringifyRequest(jsonData, { format });
      await writeFile(itemPath, content);
    } catch (error) {
      return Promise.reject(error);
    }
  });

  // rename item
  ipcMain.handle('renderer:rename-item-filename', async (event, { oldPath, newPath, newName, newFilename, collectionPathname }) => {
    const tempDir = path.join(os.tmpdir(), `temp-folder-${Date.now()}`);
    const isWindowsOSAndNotWSLPathAndItemHasSubDirectories = isDirectory(oldPath) && isWindowsOS() && !isWSLPath(oldPath) && hasSubDirectories(oldPath);
    try {
      validatePathIsInsideCollection(oldPath);
      validatePathIsInsideCollection(newPath);

      // Check if the old path exists
      if (!fs.existsSync(oldPath)) {
        throw new Error(`path: ${oldPath} does not exist`);
      }

      if (!safeToRename(oldPath, newPath)) {
        throw new Error(`path: ${newPath} already exists`);
      }

      const format = getCollectionFormat(collectionPathname);

      if (isDirectory(oldPath)) {
        const folderFilePath = path.join(oldPath, `folder.${format}`);
        let folderFileJsonContent;
        if (fs.existsSync(folderFilePath)) {
          const oldFolderFileContent = await fs.promises.readFile(folderFilePath, 'utf8');
          folderFileJsonContent = await parseFolder(oldFolderFileContent, { format });
          folderFileJsonContent.meta.name = newName;
        } else {
          folderFileJsonContent = {
            meta: {

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Refresh the tree and confirm oldPath exists before showing the rename dialog.
  2. If the file was already renamed, update state and skip.
  3. Watch for watcher 'unlink' events to invalidate stale paths in the UI.

Example fix

// before
await window.Ipc.invoke('renderer:rename-item-filename', { oldPath, newPath, newName, newFilename, collectionPathname });

// after
if (!(await window.ipc.invoke('main:path-exists', oldPath))) { await refreshTree(); return; }
await window.Ipc.invoke('renderer:rename-item-filename', { oldPath, newPath, newName, newFilename, collectionPathname });
Defensive patterns

Strategy: validation

Validate before calling

if (!(await window.ipc.invoke('main:path-exists', oldPath))) {
  await refreshTree(); throw new Error('source item no longer exists');
}
await window.Ipc.invoke('renderer:rename-item-filename', { oldPath, newPath, newName, newFilename, collectionPathname });

Type guard

async function sourceExists(p: string): Promise<boolean> {
  return Boolean(await window.ipc.invoke('main:path-exists', p));
}

Try / catch

try {
  await window.Ipc.invoke('renderer:rename-item-filename', { oldPath, newPath, newName, newFilename, collectionPathname });
} catch (e) {
  if (String(e?.message).includes('does not exist')) { await refreshTree(); return; }
  throw e;
}

Prevention

When it happens

Trigger: Renaming a file/folder that was removed between the UI action and the IPC call, or passing an oldPath from a stale collection tree.

Common situations: External deletion, git branch switch, sync conflict resolution, or the file was renamed once already and the UI still holds the old path.

Related errors


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