{"record":{"id":"defba24ae5012201","repo":"maotoumao/MusicFree","slug":"res-message","errorCode":null,"errorMessage":"安装失败: ${res.message}","messagePattern":"安装失败: \\$\\{res\\.message\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/entry/bootstrap/bootstrap.ts","lineNumber":250,"sourceCode":"                    .split(\",\")\n                    .map(decodeURIComponent);\n                await Promise.all(\n                    plugins.map(it =>\n                        PluginManager.installPluginFromUrl(it).catch(emptyFunction),\n                    ),\n                );\n                Toast.success(\"安装成功~\");\n            } else if (url.endsWith(\".js\")) {\n                PluginManager.installPluginFromLocalFile(url, {\n                    notCheckVersion: Config.getConfig(\n                        \"basic.notCheckPluginVersion\",\n                    ),\n                })\n                    .then(res => {\n                        if (res.success) {\n                            Toast.success(`插件「${res.pluginName}」安装成功~`);\n                        } else {\n                            Toast.warn(\"安装失败: \" + res.message);\n                        }\n                    })\n                    .catch(e => {\n                        console.log(e);\n                        Toast.warn(e?.message ?? \"无法识别此插件\");\n                    });\n            } else if (supportLocalMediaType.some(it => url.endsWith(it))) {\n                // 本地播放\n                const musicItem = await PluginManager.getByHash(\n                    localPluginHash,\n                )?.instance?.importMusicItem?.(url);\n                console.log(musicItem);\n                if (musicItem) {\n                    TrackPlayer.play(musicItem);\n                }\n            }\n        } catch { }\n    }","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/maotoumao/MusicFree/blob/d118b18b3d0c904400f7eea7bf99c0ceec6c1aee/src/entry/bootstrap/bootstrap.ts#L232-L268","documentation":"handleLinkingUrl in src/entry/bootstrap/bootstrap.ts installs a plugin from a deep-link/URL; the install promise resolves with {success, pluginName, message}. When success is false the code toasts `安装失败: ${res.message}` (\"install failed\"). The thrown-looking message is a user-facing toast carrying the installer's failure reason.","triggerScenarios":"Opening a musicfree:// (or similar) plugin install link where the downloader reports failure: URL unreachable, response is not valid JS/plugin code, hash mismatch, plugin storage error, or the target host refuses the request.","commonSituations":"Sharing plugin links whose host is down or behind a firewall/CDN block; link pointing to an HTML error page instead of plugin JS; expired GitHub release/raw links; network proxy interfering; plugin source requires headers the installer doesn't send.","solutions":["Read the res.message in the toast — it names the installer's failure (network, invalid code, etc.) and fix that specific cause.","Open the plugin URL in a browser to confirm it serves raw JS, not an HTML page or 404.","Retry on a different network / without proxy; GitHub raw links are often blocked in some regions.","Install the plugin by re-sharing a valid link or from the plugin marketplace instead of the deep link."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const resp = await fetch(pluginUrl, { method: 'HEAD' });\nconst ct = resp.headers.get('content-type') ?? '';\nif (!resp.ok || ct.includes('text/html')) throw new Error('URL 不是有效的插件文件');","typeGuard":"function isInstallResult(r: unknown): r is { success: boolean; pluginName?: string; message?: string } {\n  return !!r && typeof (r as any).success === 'boolean';\n}","tryCatchPattern":"installPluginFromUrl(url)\n  .then(res => res.success\n    ? Toast.success(`插件「${res.pluginName}」安装成功~`)\n    : Toast.warn('安装失败: ' + res.message))\n  .catch(e => Toast.warn(e?.message ?? '无法识别此插件'));","preventionTips":["Verify the link serves raw JS (not an HTML page) before installing.","Prefer marketplace/official sources over hand-copied deep links.","Retry on another network if GitHub raw/CDN hosts are blocked in your region.","Surface res.message clearly so the user knows whether it's network or content failure."],"tags":["plugin-install","deep-link","network","toast"],"backgroundTag":"plugin-install-failed","analyzedSha":"d118b18b3d0c904400f7eea7bf99c0ceec6c1aee","analyzedAt":"2026-08-30T11:49:12.932Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}