Molunerfinn/PicGo · error

Setting window not found

Error message

Setting window not found

What it means

IMPORT_LOCAL_PLUGIN needs the SETTING_WINDOW BrowserWindow as the parent for the directory-picker dialog. windowManager.get(IWindowList.SETTING_WINDOW) returned undefined, so the route throws 'Setting window not found' before opening the dialog. This indicates the settings window was never created or has been closed/destroyed.

Source

Thrown at src/main/events/rpc/routes/plugins.ts:72

    const result = await picgo.pluginHandler.install([fullName])

    if (!result.success) {
      showNotification({
        title: T('PLUGIN_INSTALL_FAILED'),
        body: result.body as string
      })
      return fail(new Error(result.body as string))
    }

    shortKeyHandler.registerPluginShortKey(result.body[0])
    return ok(result.body[0])
  })
  .add(IRPCActionType.IMPORT_LOCAL_PLUGIN, async () => {
    try {
      const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)

      if (!settingWindow) {
        throw new Error('Setting window not found')
      }

      const dialogResult = await dialog.showOpenDialog(settingWindow, {
        properties: ['openDirectory']
      })

      const filePaths = dialogResult.filePaths

      if (filePaths.length === 0) {
        return ok(null)
      }

      const result = await picgo.pluginHandler.install(filePaths)

      if (!result.success) {
        showNotification({
          title: T('PLUGIN_IMPORT_FAILED'),
          body: result.body as string

View on GitHub (pinned to 07ec7068a5)

Solutions

  1. Ensure the settings window is open before triggering local plugin import
  2. Fall back to dialog.showOpenDialog() without a parent window when settingWindow is missing
  3. Check windowManager/IWindowList initialization order at startup
  4. Reopen the settings window programmatically then retry the import

Example fix

// before
const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)
if (!settingWindow) throw new Error('Setting window not found')
// after
const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)
const dialogResult = settingWindow
  ? await dialog.showOpenDialog(settingWindow, { properties: ['openDirectory'] })
  : await dialog.showOpenDialog({ properties: ['openDirectory'] })
Defensive patterns

Strategy: fallback

Validate before calling

const win = windowManager.get(IWindowList.SETTING_WINDOW)
if (!win || win.isDestroyed()) {
  await createWindow(IWindowList.SETTING_WINDOW)
}

Type guard

function settingWindowAvailable() {
  const win = windowManager.get(IWindowList.SETTING_WINDOW)
  return !!win && !win.isDestroyed()
}

Try / catch

try {
  await importLocalPlugin()
} catch (e) {
  if (e.message === 'Setting window not found') {
    await openSettingsWindowThenImport(pluginPath)
  } else throw e
}

Prevention

When it happens

Trigger: Invoking IRPCActionType.IMPORT_LOCAL_PLUGIN while the settings window is closed or still initializing; triggering the import from a tray/menu context before windowManager has created SETTING_WINDOW.

Common situations: Automated tests or scripts calling the RPC without any window; app quitting flow where windows are destroyed but IPC is still handled; race where import is triggered during startup before windows are registered.

Related errors


AI-assisted analysis of Molunerfinn/PicGo@07ec7068a5 (2026-08-30). Data as JSON: /api/errors/fa91ebf4f5ca936e. Report an issue: GitHub.