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 stringView on GitHub (pinned to 07ec7068a5)
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
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
- 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
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
- Failed to check latest version
- Toolbox fix failed
- Failed to get window state
- Failed to load provider configs
- Failed to select provider config
AI-assisted analysis of Molunerfinn/PicGo@07ec7068a5 (2026-08-30).
Data as JSON: /api/errors/fa91ebf4f5ca936e.
Report an issue: GitHub.