maotoumao/MusicFree · error

toast.failToUpdatePlugin

Error message

toast.failToUpdatePlugin

What it means

This fallback toast is displayed when `pluginManager.updatePlugin(plugin)` throws during the 'Update plugin' option. The handler prefers the thrown error's own `message` and falls back to the generic 'failToUpdatePlugin' i18n string when the error carries no message. Update failures typically come from fetching the remote plugin source (network errors, 404s) or from the updated plugin failing to parse/validate.

Source

Thrown at src/pages/setting/settingTypes/pluginSetting/components/pluginItem.tsx:49

function _PluginItem(props: IPluginItemProps) {
    const { plugin } = props;
    const colors = useColors();
    const enabled = usePluginEnabled(plugin);
    const { t } = useI18N();
    const rerender = useRerender();

    const alternativePluginName = pluginManager.getAlternativePluginName(plugin);

    const options: IOption[] = [
        {
            title: t("pluginSetting.pluginItem.options.updatePlugin"),
            icon: "arrow-path",
            async onPress() {
                try {
                    await pluginManager.updatePlugin(plugin);
                    Toast.success(t("toast.pluginUpdateSuccess"));
                } catch (e: any) {
                    Toast.warn(e?.message ?? t("toast.failToUpdatePlugin"));
                }
            },
            show: !!plugin.instance.srcUrl,
        },
        {
            title: t("pluginSetting.pluginItem.options.sharePlugin"),
            icon: "share",
            async onPress() {
                try {
                    Clipboard.setString(plugin.instance.srcUrl!);
                    Toast.success(t("toast.copiedToClipboard"));
                } catch (e: any) {
                    Toast.warn(e?.message ?? t("toast.failToSharePlugin"));
                }
            },
            show: !!plugin.instance.srcUrl,
        },
        {

View on GitHub (pinned to d118b18b3d)

Solutions

  1. Read the surfaced `e.message` toast: if it mentions network/HTTP, verify the plugin's srcUrl is reachable in a browser and fix or re-add the plugin with a valid URL.
  2. Check device connectivity or configure a proxy if the source host (e.g. raw.githubusercontent.com) is blocked.
  3. If the error is parse/version related, update the app itself or install a plugin version compatible with the current app version.
  4. As a workaround, uninstall the plugin and re-install it from a fresh, known-good source URL instead of updating in place.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

const srcUrl = plugin.instance.srcUrl;
if (!srcUrl) {
    Toast.warn(t("toast.failToUpdatePlugin"));
    return;
}
const reachable = await fetch(srcUrl, { method: "HEAD" }).then(r => r.ok).catch(() => false);
if (!reachable) {
    Toast.warn(t("toast.failToUpdatePlugin"));
    return;
}

Type guard

function hasSrcUrl(p: Plugin): p is Plugin & { instance: { srcUrl: string } } {
    return typeof p.instance.srcUrl === "string" && p.instance.srcUrl.length > 0;
}

Try / catch

try {
    await pluginManager.updatePlugin(plugin);
    Toast.success(t("toast.pluginUpdateSuccess"));
} catch (e: any) {
    Toast.warn(e?.message ?? t("toast.failToUpdatePlugin"));
}

Prevention

When it happens

Trigger: Selecting the update option on a plugin whose `instance.srcUrl` exists, and `await pluginManager.updatePlugin(plugin)` rejects — e.g. the srcUrl is unreachable, the download fails, the response is not a valid plugin module, or a version-incompatibility check fails inside the plugin manager.

Common situations: Plugin author deleted or moved the raw source URL (404); device offline or behind a captive portal/GFW needing proxy; GitHub raw access rate-limited; the remote script has a syntax error or uses APIs incompatible with the current app version; storage failure while persisting the updated plugin.

Related errors


AI-assisted analysis of maotoumao/MusicFree@d118b18b3d (2026-08-30). Data as JSON: /api/errors/d75cef11dcb9f158. Report an issue: GitHub.