{"record":{"id":"639e9092e701e451","repo":"usebruno/bruno","slug":"path-itempath-does-not-exist","errorCode":null,"errorMessage":"path: ${itemPath} does not exist","messagePattern":"path: (.+?) does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":1050,"sourceCode":"        const uniqueFileName = generateUniqueName(baseFileName, (name) => fs.existsSync(path.join(filePath, `${name}.json`)));\n        const fullPath = path.join(filePath, `${uniqueFileName}.json`);\n        const jsonContent = JSON.stringify(environmentWithInfo(environment), null, 2);\n        await fs.promises.writeFile(fullPath, jsonContent, 'utf8');\n      } else {\n        throw new Error(`Unsupported export format: ${exportFormat}`);\n      }\n    } catch (error) {\n      return Promise.reject(error);\n    }\n  });\n\n  // rename item\n  ipcMain.handle('renderer:rename-item-name', async (event, { itemPath, newName, collectionPathname }) => {\n    try {\n      validatePathIsInsideCollection(itemPath);\n\n      if (!fs.existsSync(itemPath)) {\n        throw new Error(`path: ${itemPath} does not exist`);\n      }\n\n      if (isDirectory(itemPath)) {\n        const format = getCollectionFormat(collectionPathname);\n        const folderFilePath = path.join(itemPath, `folder.${format}`);\n        let folderFileJsonContent;\n        if (fs.existsSync(folderFilePath)) {\n          const oldFolderFileContent = await fs.promises.readFile(folderFilePath, 'utf8');\n          folderFileJsonContent = await parseFolder(oldFolderFileContent, { format });\n          folderFileJsonContent.meta.name = newName;\n        } else {\n          folderFileJsonContent = {\n            meta: {\n              name: newName\n            }\n          };\n        }\n","sourceCodeStart":1032,"sourceCodeEnd":1068,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L1032-L1068","documentation":"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.","triggerScenarios":"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.","commonSituations":"File watcher race (item deleted then rename clicked), external git operation removed the file, collection moved, or duplicate path entries in the tree.","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."],"exampleFix":"// before\nawait window.Ipc.invoke('renderer:rename-item-name', { itemPath: stalePath, newName, collectionPathname });\n\n// after\nconst exists = await window.ipc.invoke('main:path-exists', stalePath);\nif (!exists) { await refreshTree(); return; }\nawait window.Ipc.invoke('renderer:rename-item-name', { itemPath: stalePath, newName, collectionPathname });","handlingStrategy":"validation","validationCode":"if (!(await window.ipc.invoke('main:path-exists', itemPath))) {\n  await refreshTree(); throw new Error('item no longer exists');\n}\nawait window.Ipc.invoke('renderer:rename-item-name', { itemPath, newName, collectionPathname });","typeGuard":"async function itemExists(p: string): Promise<boolean> {\n  return Boolean(await window.ipc.invoke('main:path-exists', p));\n}","tryCatchPattern":"try {\n  await window.Ipc.invoke('renderer:rename-item-name', { itemPath, newName, collectionPathname });\n} catch (e) {\n  if (String(e?.message).includes('does not exist')) { await refreshTree(); return; }\n  throw e;\n}","preventionTips":["Refresh the tree after external filesystem changes.","Disable rename for nodes flagged missing by the watcher.","Handle watcher 'unlink' to clear stale paths."],"tags":["ipc","rename","filesystem","electron"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}