usebruno/bruno · error · Error

folder: ${folderPath} does not exist

Error message

folder: ${folderPath} does not exist

What it means

Thrown by 'renderer:move-folder-item' when fs.existsSync(folderPath) is false. The handler relocates a folder (and re-maps its request UIDs) into a destination, and refuses when the source folder is missing.

Source

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

      moveRequestUid(sourcePathname, targetPathname);

      return { newPathname: targetPathname };
    } catch (error) {
      return Promise.reject(error);
    }
  });

  ipcMain.handle('renderer:move-folder-item', async (event, folderPath, destinationPath) => {
    try {
      validatePathIsInsideCollection(folderPath);
      validatePathIsInsideCollection(destinationPath);

      const folderName = path.basename(folderPath);
      const newFolderPath = path.join(destinationPath, folderName);

      if (!fs.existsSync(folderPath)) {
        throw new Error(`folder: ${folderPath} does not exist`);
      }

      if (fs.existsSync(newFolderPath)) {
        throw new Error(`folder: ${newFolderPath} already exists`);
      }

      const requestFilesAtSource = await searchForRequestFiles(folderPath);

      for (let requestFile of requestFilesAtSource) {
        const newRequestFilePath = requestFile.replace(folderPath, newFolderPath);
        moveRequestUid(requestFile, newRequestFilePath);
      }

      fs.renameSync(folderPath, newFolderPath);
    } catch (error) {
      return Promise.reject(error);
    }
  });

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Verify folderPath exists before enabling the move action; refresh on 'unlink'.
  2. If the folder was already moved, update state and skip.
  3. Invalidate the stale tree node when the underlying folder disappears.

Example fix

// before
await window.Ipc.invoke('renderer:move-folder-item', staleFolderPath, destinationPath);

// after
if (!(await window.ipc.invoke('main:path-exists', folderPath))) { await refreshTree(); return; }
await window.Ipc.invoke('renderer:move-folder-item', folderPath, destinationPath);
Defensive patterns

Strategy: validation

Validate before calling

if (!(await window.ipc.invoke('main:path-exists', folderPath))) {
  await refreshTree(); throw new Error('source folder no longer exists');
}
await window.Ipc.invoke('renderer:move-folder-item', folderPath, destinationPath);

Type guard

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

Try / catch

try {
  await window.Ipc.invoke('renderer:move-folder-item', folderPath, destinationPath);
} catch (e) {
  if (String(e?.message).includes('does not exist')) { await refreshTree(); return; }
  throw e;
}

Prevention

When it happens

Trigger: Moving a folder that was deleted externally, already moved, or whose path is stale in the tree when the move IPC fires.

Common situations: Watcher race, concurrent drag operations, external git/filesystem change, or a previous move left a stale node.

Related errors


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