{"record":{"id":"7895f85ed50e94e9","repo":"qishibo/AnotherRedisDesktopManager","slug":"file-input-error-e-message","errorCode":null,"errorMessage":"File Input Error: ${e.message}","messagePattern":"File Input Error: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/FileInput.vue","lineNumber":44,"sourceCode":"      this.$emit('update:bookmark', '');\n    },\n    focus(e) {\n      // edit is forbidden, input blur\n      e.target.blur();\n    },\n    showFileSelector() {\n      remote.dialog.showOpenDialog(remote.getCurrentWindow(), {\n        securityScopedBookmarks: true,\n        properties: ['openFile', 'showHiddenFiles'],\n      }).then((reply) => {\n        if (reply.canceled) {\n          return;\n        }\n\n        reply.filePaths && this.$emit('update:file', reply.filePaths[0]);\n        reply.bookmarks && this.$emit('update:bookmark', reply.bookmarks[0]);\n      }).catch((e) => {\n        this.$message.error(`File Input Error: ${e.message}`);\n      });\n    },\n  },\n};\n</script>\n","sourceCodeStart":26,"sourceCodeEnd":50,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/FileInput.vue#L26-L50","documentation":"remote.dialog.showOpenDialog() rejected in FileInput's file selector. Electron dialog failures occur when the remote module is misconfigured (Electron 14+ requires @electron/remote, which can be missing or disabled), the parent window is destroyed before the dialog resolves, or the OS blocks the dialog (sandbox permissions, headless Linux without a desktop portal). The raw message is shown with a 'File Input Error' prefix.","triggerScenarios":"Closing the window while the native dialog is open; running on Electron 14+ where remote was removed but @electron/remote is not enabled; Linux without xdg-desktop-portal; the dialog invoked after app quit started.","commonSituations":"Electron upgrades breaking remote usage, CI/headless environments, sandboxed builds lacking dialog permissions, races during window teardown.","solutions":["Verify @electron/remote is installed and initialized in the main process on Electron 14+","Guard with win.isDestroyed() before and after awaiting the dialog","Prefer an IPC call to a main-process dialog.showOpenDialog instead of remote","Check OS desktop/portal availability on Linux"],"exampleFix":"// before\nremote.dialog.showOpenDialog(remote.getCurrentWindow(), {\n  properties: ['openFile', 'showHiddenFiles'],\n}).then(/* ... */).catch((e) => {\n  this.$message.error(`File Input Error: ${e.message}`);\n});\n\n// after (main process via IPC, no remote)\n// main.js\nconst { dialog, ipcMain, BrowserWindow } = require('electron');\nipcMain.handle('open-file-dialog', async (event, opts) => {\n  const win = BrowserWindow.fromWebContents(event.sender);\n  if (!win || win.isDestroyed()) return { canceled: true };\n  return dialog.showOpenDialog(win, opts);\n});\n// renderer\nconst reply = await ipcRenderer.invoke('open-file-dialog', {\n  properties: ['openFile', 'showHiddenFiles'],\n});\nif (!reply.canceled && reply.filePaths) {\n  this.$emit('update:file', reply.filePaths[0]);\n}","handlingStrategy":"try-catch","validationCode":"const win = remote.getCurrentWindow && remote.getCurrentWindow();\nif (!win || win.isDestroyed()) {\n  this.$message.error('Window closed, cannot open file dialog');\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  const reply = await remote.dialog.showOpenDialog(remote.getCurrentWindow(), opts);\n  if (!reply.canceled && reply.filePaths) {\n    this.$emit('update:file', reply.filePaths[0]);\n  }\n} catch (e) {\n  // window destroyed or remote unavailable: degrade gracefully\n  this.$message.error(`File Input Error: ${e.message}`);\n}","preventionTips":["On Electron 14+, use @electron/remote or move dialogs to main via ipcMain.handle","Check isDestroyed() before using a window reference","Never assume the dialog resolves — always handle rejection","Avoid opening dialogs during window teardown or app quit"],"tags":["electron","showopendialog","remote-module","ipc","dialog"],"backgroundTag":"electron-dialog-error","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}