{"record":{"id":"024a822453b685c8","repo":"Molunerfinn/PicGo","slug":"install-plugin-failed","errorCode":null,"errorMessage":"Install plugin failed","messagePattern":"Install plugin failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/renderer/store/plugins/actions.ts","lineNumber":186,"sourceCode":"        : normalizedResults\n\n      usePluginStore.setState((state) => {\n        state.rawSearchResults = normalizedResults\n        state.searchResults = filteredResults\n        state.isSearching = false\n      })\n    } catch (error) {\n      pluginStoreActions.setSearching(false)\n      throw error\n    }\n  },\n  async installPlugin (fullName: string) {\n    pluginStoreActions.setMutating(fullName, true)\n\n    try {\n      const result = await pluginsAdapter.installPlugin(fullName)\n      if (!result.success) {\n        throw new Error(result.errMsg || result.body || 'Install plugin failed')\n      }\n\n      await appActions.hydrateAppState()\n      const installedPlugins = await pluginsAdapter.getInstalledPlugins()\n      pluginStoreActions.setInstalledPlugins(installedPlugins.map(mapInstalledPluginItem))\n      toast.success(i18n.t('PLUGIN_INSTALL_SUCCEED'))\n    } finally {\n      pluginStoreActions.setMutating(fullName, false)\n    }\n  },\n  async setPluginEnabled (fullName: string, enabled: boolean) {\n    pluginStoreActions.setMutating(fullName, true)\n\n    try {\n      const result = await pluginsAdapter.togglePluginEnabled(fullName, enabled)\n\n      if (!result.success) {\n        throw new Error(result.error || 'Toggle plugin failed')","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/Molunerfinn/PicGo/blob/07ec7068a5512344da093d49a8408fa63ba3421e/src/renderer/store/plugins/actions.ts#L168-L204","documentation":"installPlugin throws when the INSTALL_PLUGIN RPC via pluginsAdapter.installPlugin(fullName) returns success:false. The thrown message prefers the RPC errMsg, then body, then the literal fallback 'Install plugin failed'. It is caught by the surrounding try/catch which resets the mutating flag, so the error surfaces to the caller/UI as a toast-worthy failure.","triggerScenarios":"npm install of the plugin fails in the main process: package name not found on the registry, version conflict with picgo core, network/proxy/registry mirror failure, permission error writing node_modules, or plugin incompatible with the current API version.","commonSituations":"Typo'd or non-existent plugin fullName (e.g. missing picgo-plugin- prefix handled by streamlinePluginName but name still wrong); corporate proxy blocking registry; installing a plugin built for an older PicGo core; disk/permission issues on the Electron userData path.","solutions":["Read result.errMsg in the thrown Error — it contains npm's actual failure output; verify the package name on npm.","Check network/registry access (set ELECTRON_MIRROR or npm registry mirror if downloads are slow/blocked).","Verify plugin compatibility with the installed PicGo core version; try a different plugin version.","Check write permissions on the config/plugin directory, then retry install.","If install repeatedly fails, restart the app to clear a wedged main-process plugin manager."],"exampleFix":"// before\nconst result = await pluginsAdapter.installPlugin(fullName)\nif (!result.success) {\n  throw new Error(result.errMsg || result.body || 'Install plugin failed')\n}\n// after\nconst result = await pluginsAdapter.installPlugin(fullName.trim())\nif (!result.success) {\n  const detail = result.errMsg || result.body || i18n.t('PLUGIN_INSTALL_FAILED')\n  toast.error(detail)\n  throw new Error(detail)\n}","handlingStrategy":"try-catch","validationCode":"const fullName = 'picgo-plugin-webp'\nif (typeof fullName !== 'string' || fullName.trim().length === 0) {\n  throw new Error('Plugin name is required')\n}\n// Optionally verify existence on the registry before install\nconst res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(streamlinePluginName(fullName))}`)\nif (!res.ok) toast.error('Package not found on npm registry')","typeGuard":"function isPluginInstallResult(r: { success: boolean, errMsg?: string, body?: string }): r is { success: true } {\n  return r.success === true\n}","tryCatchPattern":"try {\n  await pluginStoreActions.installPlugin(fullName)\n  toast.success(i18n.t('PLUGIN_INSTALL_SUCCEED'))\n} catch (e) {\n  // action already resets mutating flag; show npm's detail\n  toast.error(e instanceof Error ? e.message : i18n.t('PLUGIN_INSTALL_FAILED'))\n}","preventionTips":["Verify the plugin package name on npm before installing.","Ensure registry/network access (configure mirrors or proxy for corporate environments).","Check plugin compatibility with your PicGo core version.","Confirm write permissions on the app's plugin/config directory.","Retry once after transient npm network failures before surfacing an error."],"tags":["plugin","npm","rpc","network"],"backgroundTag":"plugin-install-failed","analyzedSha":"07ec7068a5512344da093d49a8408fa63ba3421e","analyzedAt":"2026-08-30T01:45:22.289Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}