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
- 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.
- Check device connectivity or configure a proxy if the source host (e.g. raw.githubusercontent.com) is blocked.
- If the error is parse/version related, update the app itself or install a plugin version compatible with the current app version.
- 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
- Ensure the plugin's srcUrl points to a stable, reachable raw source (avoid rate-limited hosts).
- Check connectivity/proxy settings before updating plugins behind restricted networks.
- Keep the app updated so plugin version-compatibility checks pass.
- Prefer re-installing from a known-good URL when in-place updates repeatedly fail.
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
- panel.imageViewer.saveImageFail
- toast.resumeFail
- 安装失败: ${res.message}
- 当前无网络连接,请等待网络恢复后重试
- dialog.markdownDialog.openExternalLink
AI-assisted analysis of maotoumao/MusicFree@d118b18b3d (2026-08-30).
Data as JSON: /api/errors/d75cef11dcb9f158.
Report an issue: GitHub.