Molunerfinn/PicGo · error

Import local plugin failed

Error message

Import local plugin failed

What it means

importLocalPlugin delegates to pluginsAdapter.importLocalPlugin() (IPC into the main process) and throws this error when the adapter result reports success:false. The literal message is a fallback used when result.error is empty, meaning the main process failed without returning a specific reason. The action sets importingLocal(true) first and clears it in the finally path.

Source

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

        status: content.trim() ? pluginReadmeStatus.Ready : pluginReadmeStatus.Empty,
        content,
        errorMessage: null
      })
    } catch (error) {
      pluginStoreActions.setReadmeState(fullName, {
        status: pluginReadmeStatus.Error,
        content: '',
        errorMessage: error instanceof Error ? error.message : String(error)
      })
    }
  },
  async importLocalPlugin (): Promise<PluginImportResult | null> {
    pluginStoreActions.setImportingLocal(true)

    try {
      const result = await pluginsAdapter.importLocalPlugin()
      if (!result.success) {
        throw new Error(result.error || 'Import local plugin failed')
      }

      if (!result.data) {
        return null
      }

      await appActions.hydrateAppState()
      const installedPlugins = await pluginsAdapter.getInstalledPlugins()
      pluginStoreActions.setInstalledPlugins(installedPlugins.map(mapInstalledPluginItem))
      const installedPlugin = useAppStore.getState().pluginsInstalled.find(
        (item) => item.fullName === result.data || item.name === result.data
      )

      if (!installedPlugin) {
        throw new Error('Imported plugin not found')
      }

      toast.success(i18n.t('PLUGIN_IMPORT_SUCCEED'))

View on GitHub (pinned to 07ec7068a5)

Solutions

  1. Catch the error and surface result.error text if available; prefer errors returned by the adapter over the fallback message.
  2. Verify the selected path is a valid PicGo plugin directory containing package.json with a matching main entry.
  3. Rebuild/reinstall the local plugin so it matches the app's Node/Electron version.
  4. Check file read permissions on the plugin path and retry the import.

Example fix

// before
const imported = await pluginStoreActions.importLocalPlugin()

// after
try {
  const imported = await pluginStoreActions.importLocalPlugin()
} catch (err) {
  toast.error((err as Error).message)
} finally {
  pluginStoreActions.setImportingLocal(false)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check the chosen path is a plugin-like directory before import
const isPluginDir = await window.db.confirm({
  title: i18n.t('PLUGIN_IMPORT_CONFIRM')
})
if (!isPluginDir) return

Type guard

function isFailedImport(
  result: PluginImportResult
): result is { success: false; error?: string } {
  return result.success === false
}

Try / catch

try {
  const imported = await pluginStoreActions.importLocalPlugin()
} catch (err) {
  toast.error(i18n.t('PLUGIN_IMPORT_FAILED') + ': ' + (err as Error).message)
}

Prevention

When it happens

Trigger: Calling importLocalPlugin() when the main-process import fails: the selected file cannot be read, the npm package is malformed (no package.json/main), the plugin directory is not a valid PicGo plugin, or the adapter resolves with { success: false, error: undefined }.

Common situations: User picks a wrong file type in the import dialog; plugin bundle was built for a different Node/Electron ABI; permission errors reading the plugin path; installing from a corrupted or partially extracted archive.

Related errors


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