Molunerfinn/PicGo · error

Install plugin failed

Error message

Install plugin failed

What it means

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.

Source

Thrown at src/renderer/store/plugins/actions.ts:186

        : normalizedResults

      usePluginStore.setState((state) => {
        state.rawSearchResults = normalizedResults
        state.searchResults = filteredResults
        state.isSearching = false
      })
    } catch (error) {
      pluginStoreActions.setSearching(false)
      throw error
    }
  },
  async installPlugin (fullName: string) {
    pluginStoreActions.setMutating(fullName, true)

    try {
      const result = await pluginsAdapter.installPlugin(fullName)
      if (!result.success) {
        throw new Error(result.errMsg || result.body || 'Install plugin failed')
      }

      await appActions.hydrateAppState()
      const installedPlugins = await pluginsAdapter.getInstalledPlugins()
      pluginStoreActions.setInstalledPlugins(installedPlugins.map(mapInstalledPluginItem))
      toast.success(i18n.t('PLUGIN_INSTALL_SUCCEED'))
    } finally {
      pluginStoreActions.setMutating(fullName, false)
    }
  },
  async setPluginEnabled (fullName: string, enabled: boolean) {
    pluginStoreActions.setMutating(fullName, true)

    try {
      const result = await pluginsAdapter.togglePluginEnabled(fullName, enabled)

      if (!result.success) {
        throw new Error(result.error || 'Toggle plugin failed')

View on GitHub (pinned to 07ec7068a5)

Solutions

  1. Read result.errMsg in the thrown Error — it contains npm's actual failure output; verify the package name on npm.
  2. Check network/registry access (set ELECTRON_MIRROR or npm registry mirror if downloads are slow/blocked).
  3. Verify plugin compatibility with the installed PicGo core version; try a different plugin version.
  4. Check write permissions on the config/plugin directory, then retry install.
  5. If install repeatedly fails, restart the app to clear a wedged main-process plugin manager.

Example fix

// before
const result = await pluginsAdapter.installPlugin(fullName)
if (!result.success) {
  throw new Error(result.errMsg || result.body || 'Install plugin failed')
}
// after
const result = await pluginsAdapter.installPlugin(fullName.trim())
if (!result.success) {
  const detail = result.errMsg || result.body || i18n.t('PLUGIN_INSTALL_FAILED')
  toast.error(detail)
  throw new Error(detail)
}
Defensive patterns

Strategy: try-catch

Validate before calling

const fullName = 'picgo-plugin-webp'
if (typeof fullName !== 'string' || fullName.trim().length === 0) {
  throw new Error('Plugin name is required')
}
// Optionally verify existence on the registry before install
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(streamlinePluginName(fullName))}`)
if (!res.ok) toast.error('Package not found on npm registry')

Type guard

function isPluginInstallResult(r: { success: boolean, errMsg?: string, body?: string }): r is { success: true } {
  return r.success === true
}

Try / catch

try {
  await pluginStoreActions.installPlugin(fullName)
  toast.success(i18n.t('PLUGIN_INSTALL_SUCCEED'))
} catch (e) {
  // action already resets mutating flag; show npm's detail
  toast.error(e instanceof Error ? e.message : i18n.t('PLUGIN_INSTALL_FAILED'))
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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