qishibo/AnotherRedisDesktopManager · error

File Input Error: ${e.message}

Error message

File Input Error: ${e.message}

What it means

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.

Source

Thrown at src/components/FileInput.vue:44

      this.$emit('update:bookmark', '');
    },
    focus(e) {
      // edit is forbidden, input blur
      e.target.blur();
    },
    showFileSelector() {
      remote.dialog.showOpenDialog(remote.getCurrentWindow(), {
        securityScopedBookmarks: true,
        properties: ['openFile', 'showHiddenFiles'],
      }).then((reply) => {
        if (reply.canceled) {
          return;
        }

        reply.filePaths && this.$emit('update:file', reply.filePaths[0]);
        reply.bookmarks && this.$emit('update:bookmark', reply.bookmarks[0]);
      }).catch((e) => {
        this.$message.error(`File Input Error: ${e.message}`);
      });
    },
  },
};
</script>

View on GitHub (pinned to c149855106)

Solutions

  1. Verify @electron/remote is installed and initialized in the main process on Electron 14+
  2. Guard with win.isDestroyed() before and after awaiting the dialog
  3. Prefer an IPC call to a main-process dialog.showOpenDialog instead of remote
  4. Check OS desktop/portal availability on Linux

Example fix

// before
remote.dialog.showOpenDialog(remote.getCurrentWindow(), {
  properties: ['openFile', 'showHiddenFiles'],
}).then(/* ... */).catch((e) => {
  this.$message.error(`File Input Error: ${e.message}`);
});

// after (main process via IPC, no remote)
// main.js
const { dialog, ipcMain, BrowserWindow } = require('electron');
ipcMain.handle('open-file-dialog', async (event, opts) => {
  const win = BrowserWindow.fromWebContents(event.sender);
  if (!win || win.isDestroyed()) return { canceled: true };
  return dialog.showOpenDialog(win, opts);
});
// renderer
const reply = await ipcRenderer.invoke('open-file-dialog', {
  properties: ['openFile', 'showHiddenFiles'],
});
if (!reply.canceled && reply.filePaths) {
  this.$emit('update:file', reply.filePaths[0]);
}
Defensive patterns

Strategy: try-catch

Validate before calling

const win = remote.getCurrentWindow && remote.getCurrentWindow();
if (!win || win.isDestroyed()) {
  this.$message.error('Window closed, cannot open file dialog');
  return;
}

Try / catch

try {
  const reply = await remote.dialog.showOpenDialog(remote.getCurrentWindow(), opts);
  if (!reply.canceled && reply.filePaths) {
    this.$emit('update:file', reply.filePaths[0]);
  }
} catch (e) {
  // window destroyed or remote unavailable: degrade gracefully
  this.$message.error(`File Input Error: ${e.message}`);
}

Prevention

When it happens

Trigger: 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.

Common situations: Electron upgrades breaking remote usage, CI/headless environments, sandboxed builds lacking dialog permissions, races during window teardown.

Related errors


AI-assisted analysis of qishibo/AnotherRedisDesktopManager@c149855106 (2026-08-22). Data as JSON: /api/errors/7895f85ed50e94e9. Report an issue: GitHub.