usebruno/bruno · error · Error
path: ${itemPath} does not exist
Error message
path: ${itemPath} does not exist What it means
Thrown by 'renderer:rename-item-name' after validatePathIsInsideCollection passes but fs.existsSync(itemPath) is false. The handler renames a request or folder in place (changing its display name) and refuses to operate on a path that is not on disk.
Source
Thrown at packages/bruno-electron/src/ipc/collection.js:1050
const uniqueFileName = generateUniqueName(baseFileName, (name) => fs.existsSync(path.join(filePath, `${name}.json`)));
const fullPath = path.join(filePath, `${uniqueFileName}.json`);
const jsonContent = JSON.stringify(environmentWithInfo(environment), null, 2);
await fs.promises.writeFile(fullPath, jsonContent, 'utf8');
} else {
throw new Error(`Unsupported export format: ${exportFormat}`);
}
} catch (error) {
return Promise.reject(error);
}
});
// rename item
ipcMain.handle('renderer:rename-item-name', async (event, { itemPath, newName, collectionPathname }) => {
try {
validatePathIsInsideCollection(itemPath);
if (!fs.existsSync(itemPath)) {
throw new Error(`path: ${itemPath} does not exist`);
}
if (isDirectory(itemPath)) {
const format = getCollectionFormat(collectionPathname);
const folderFilePath = path.join(itemPath, `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: {
name: newName
}
};
}
View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Refresh the collection tree before allowing rename; disable rename for missing paths.
- If the file was moved, locate its new path and rename there.
- Drop the stale tree node if the underlying file no longer exists.
Example fix
// before
await window.Ipc.invoke('renderer:rename-item-name', { itemPath: stalePath, newName, collectionPathname });
// after
const exists = await window.ipc.invoke('main:path-exists', stalePath);
if (!exists) { await refreshTree(); return; }
await window.Ipc.invoke('renderer:rename-item-name', { itemPath: stalePath, newName, collectionPathname }); Defensive patterns
Strategy: validation
Validate before calling
if (!(await window.ipc.invoke('main:path-exists', itemPath))) {
await refreshTree(); throw new Error('item no longer exists');
}
await window.Ipc.invoke('renderer:rename-item-name', { itemPath, newName, collectionPathname }); Type guard
async function itemExists(p: string): Promise<boolean> {
return Boolean(await window.ipc.invoke('main:path-exists', p));
} Try / catch
try {
await window.Ipc.invoke('renderer:rename-item-name', { itemPath, newName, collectionPathname });
} catch (e) {
if (String(e?.message).includes('does not exist')) { await refreshTree(); return; }
throw e;
} Prevention
- Refresh the tree after external filesystem changes.
- Disable rename for nodes flagged missing by the watcher.
- Handle watcher 'unlink' to clear stale paths.
When it happens
Trigger: Renaming an item that was deleted externally, moved by another process, or whose path was stale in the sidebar tree at the moment of the rename action.
Common situations: File watcher race (item deleted then rename clicked), external git operation removed the file, collection moved, or duplicate path entries in the tree.
Related errors
- path: ${oldPath} does not exist
- ${filename} file does not exist
- Export path: ${filePath} is not an existing directory
- path: ${itemPath} is not a valid request file
- path: ${newPath} already exists
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/639e9092e701e451.
Report an issue: GitHub.