{"record":{"id":"ed51a1f54c178f4d","repo":"Molunerfinn/PicGo","slug":"update-plugin-failed","errorCode":null,"errorMessage":"Update plugin failed","messagePattern":"Update plugin failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/renderer/store/plugins/actions.ts","lineNumber":221,"sourceCode":"      if (!result.success) {\n        throw new Error(result.error || 'Toggle 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(enabled ? 'ENABLE_PLUGIN' : 'DISABLE_PLUGIN'))\n    } finally {\n      pluginStoreActions.setMutating(fullName, false)\n    }\n  },\n  async updatePlugin (fullName: string) {\n    pluginStoreActions.setMutating(fullName, true)\n\n    try {\n      const result = await pluginsAdapter.updatePlugin(fullName)\n      if (!result.success) {\n        throw new Error(result.error || 'Update plugin failed')\n      }\n      await appActions.hydrateAppState()\n      const installedPlugins = await pluginsAdapter.getInstalledPlugins()\n      pluginStoreActions.setInstalledPlugins(installedPlugins.map(mapInstalledPluginItem))\n      await pluginsAdapter.setNeedReload(true)\n\n      useAppStore.setState((state) => {\n        if (state.appConfig) {\n          state.appConfig.needReload = true\n        }\n      })\n      toast.success(i18n.t('PLUGIN_UPDATE_SUCCEED'))\n    } finally {\n      pluginStoreActions.setMutating(fullName, false)\n    }\n  },\n  async uninstallPlugin (fullName: string) {\n    pluginStoreActions.setMutating(fullName, true)","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/Molunerfinn/PicGo/blob/07ec7068a5512344da093d49a8408fa63ba3421e/src/renderer/store/plugins/actions.ts#L203-L239","documentation":"updatePlugin throws when the UPDATE_PLUGIN RPC via pluginsAdapter.updatePlugin(fullName) returns success:false, with result.error or fallback 'Update plugin failed'. After a successful update the action rehydrates app state and flags a needReload so the plugin's new code takes effect.","triggerScenarios":"npm update in the main process fails: no newer version or registry unreachable, peer/version conflict with picgo core, network/proxy failure, or the plugin's latest version breaks (incompatible API), causing the update step to report failure.","commonSituations":"Updating while offline or behind a proxy; plugin latest release requires a newer PicGo core; registry mirror lagging; lockfile/node_modules corruption in the plugin dir.","solutions":["Read result.error for npm's failure detail; confirm network/registry access and retry.","Check whether the plugin actually needs updating — no newer version can surface as failure.","If the newest version is incompatible, pin/avoid it or upgrade PicGo core first.","Remove and reinstall the plugin if node_modules is corrupted, then retry update.","After a successful update, restart/reload the app so setNeedReload takes effect."],"exampleFix":"null","handlingStrategy":"retry","validationCode":"const installed = useAppStore.getState().pluginsInstalled\nconst plugin = installed.find(p => p.fullName === fullName)\nif (!plugin) { toast.error(i18n.t('PLUGIN_NOT_FOUND')); return }\n// skip if already latest\nif (plugin.version && plugin.latestVersion && plugin.version === plugin.latestVersion) {\n  toast.info(i18n.t('PLUGIN_ALREADY_LATEST'))\n  return\n}","typeGuard":"function isUpdateSuccess(r: { success: boolean, error?: string }): r is { success: true } {\n  return r.success === true\n}","tryCatchPattern":"try {\n  await pluginStoreActions.updatePlugin(fullName)\n  // app reloads / needReload flag set on success\n} catch (e) {\n  toast.error(e instanceof Error ? e.message : i18n.t('PLUGIN_UPDATE_FAILED'))\n  pluginStoreActions.setMutating(fullName, false)\n}","preventionTips":["Check for a newer version before invoking update to avoid needless RPC failures.","Maintain registry/mirror connectivity; configure mirrors where downloads are slow.","Upgrade PicGo core before updating plugins that require a newer API.","Reload the app after a successful update so setNeedReload takes effect."],"tags":["plugin","npm","rpc","network"],"backgroundTag":"plugin-update-failed","analyzedSha":"07ec7068a5512344da093d49a8408fa63ba3421e","analyzedAt":"2026-08-30T01:45:22.289Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}