{"record":{"id":"fa91ebf4f5ca936e","repo":"Molunerfinn/PicGo","slug":"setting-window-not-found","errorCode":null,"errorMessage":"Setting window not found","messagePattern":"Setting window not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/events/rpc/routes/plugins.ts","lineNumber":72,"sourceCode":"    const result = await picgo.pluginHandler.install([fullName])\n\n    if (!result.success) {\n      showNotification({\n        title: T('PLUGIN_INSTALL_FAILED'),\n        body: result.body as string\n      })\n      return fail(new Error(result.body as string))\n    }\n\n    shortKeyHandler.registerPluginShortKey(result.body[0])\n    return ok(result.body[0])\n  })\n  .add(IRPCActionType.IMPORT_LOCAL_PLUGIN, async () => {\n    try {\n      const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)\n\n      if (!settingWindow) {\n        throw new Error('Setting window not found')\n      }\n\n      const dialogResult = await dialog.showOpenDialog(settingWindow, {\n        properties: ['openDirectory']\n      })\n\n      const filePaths = dialogResult.filePaths\n\n      if (filePaths.length === 0) {\n        return ok(null)\n      }\n\n      const result = await picgo.pluginHandler.install(filePaths)\n\n      if (!result.success) {\n        showNotification({\n          title: T('PLUGIN_IMPORT_FAILED'),\n          body: result.body as string","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/Molunerfinn/PicGo/blob/07ec7068a5512344da093d49a8408fa63ba3421e/src/main/events/rpc/routes/plugins.ts#L54-L90","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the settings window is open before triggering local plugin import","Fall back to dialog.showOpenDialog() without a parent window when settingWindow is missing","Check windowManager/IWindowList initialization order at startup","Reopen the settings window programmatically then retry the import"],"exampleFix":"// before\nconst settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)\nif (!settingWindow) throw new Error('Setting window not found')\n// after\nconst settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)\nconst dialogResult = settingWindow\n  ? await dialog.showOpenDialog(settingWindow, { properties: ['openDirectory'] })\n  : await dialog.showOpenDialog({ properties: ['openDirectory'] })","handlingStrategy":"fallback","validationCode":"const win = windowManager.get(IWindowList.SETTING_WINDOW)\nif (!win || win.isDestroyed()) {\n  await createWindow(IWindowList.SETTING_WINDOW)\n}","typeGuard":"function settingWindowAvailable() {\n  const win = windowManager.get(IWindowList.SETTING_WINDOW)\n  return !!win && !win.isDestroyed()\n}","tryCatchPattern":"try {\n  await importLocalPlugin()\n} catch (e) {\n  if (e.message === 'Setting window not found') {\n    await openSettingsWindowThenImport(pluginPath)\n  } else throw e\n}","preventionTips":["Only trigger window-scoped RPC actions when the target window exists","Use parentless dialog.showOpenDialog as a fallback in the handler","Verify windowManager initialization completes before enabling plugin IPC"],"tags":["electron","window-management","ipc","missing-window"],"backgroundTag":"window-not-found","analyzedSha":"07ec7068a5512344da093d49a8408fa63ba3421e","analyzedAt":"2026-08-30T01:45:22.289Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}