{"record":{"id":"324c6e8584d2d7f8","repo":"maotoumao/MusicFree","slug":"error-324c6e","errorCode":null,"errorMessage":"无法识别此插件","messagePattern":"无法识别此插件","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/entry/bootstrap/bootstrap.ts","lineNumber":255,"sourceCode":"                    ),\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    }\n\n    // 开启监听\n    Linking.addEventListener(\"url\", data => {\n        if (data.url) {\n            handleLinkingUrl(data.url);","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/maotoumao/MusicFree/blob/d118b18b3d0c904400f7eea7bf99c0ceec6c1aee/src/entry/bootstrap/bootstrap.ts#L237-L273","documentation":"This is the fallback message shown when installing a plugin from a local .js file via a deep link fails and the thrown error has no usable `message`. `PluginManager.installPluginFromLocalFile` rejects when the file cannot be read, evaluated, or validated as a plugin, and handleLinkingUrl surfaces `e?.message ?? \"无法识别此插件\"` as a warning toast. It means the file the OS handed the app was not recognized as a valid MusicFree plugin.","triggerScenarios":"Opening a `file://.../*.js` deep link or share intent where the local plugin file is missing, unreadable, empty, contains a syntax error, or does not export the plugin contract (e.g. missing `_path`/`srcUrl`/required hooks); also when plugin version checks fail and the loader throws instead of resolving with {success:false}.","commonSituations":"User taps a plugin file in a file manager before download completes; the shared file URI points to a cache location the app cannot read after reboot; the plugin author published a broken or minified-incompatible .js; plugin was built for a newer plugin-API version than the app supports.","solutions":["Re-download/re-share the plugin .js file and confirm it fully exists and is non-empty before opening it with the app.","Open the .js in an editor or run it in Node to verify it parses and exports a valid plugin object (srcUrl, platform, etc.).","Enable/verify the plugin-version check bypass setting (`basic.notCheckPluginVersion`) if the plugin targets a different plugin API version.","Update the plugin to a version compatible with the installed app version.","Check console.log output (the handler logs the caught error) for the underlying read/eval error to pinpoint the cause."],"exampleFix":"// before: opening a partially downloaded file\nLinking.openURL('file:///storage/emulated/0/Download/plugin.js'); // still 0 bytes\n\n// after: verify the file first\nconst stat = await RNFS.stat('/storage/emulated/0/Download/plugin.js');\nif (stat.isFile() && stat.size > 0) {\n    Linking.openURL('file:///storage/emulated/0/Download/plugin.js');\n}","handlingStrategy":"validation","validationCode":"import { installPluginFromLocalFile } from '@/core/pluginManager';\n\nasync function canInstallLocalPlugin(path: string) {\n    return path.endsWith('.js') && path.length > 3;\n}\n\nif (!(await canInstallLocalPlugin(url))) {\n    Toast.warn('不是有效的插件文件');\n    return;\n}\nawait installPluginFromLocalFile(url)\n    .then(res => res.success\n        ? Toast.success(`插件「${res.pluginName}」安装成功~`)\n        : Toast.warn('安装失败: ' + res.message))\n    .catch(e => Toast.warn(e?.message ?? '无法识别此插件'));","typeGuard":"function isPluginError(e: unknown): e is { message?: string } {\n    return typeof e === 'object' && e !== null && ('message' in e);\n}","tryCatchPattern":"try {\n    const res = await PluginManager.installPluginFromLocalFile(url);\n    if (!res.success) throw new Error(res.message);\n    Toast.success(`插件「${res.pluginName}」安装成功~`);\n} catch (e) {\n    console.log(e);\n    Toast.warn(e?.message ?? '无法识别此插件');\n}","preventionTips":["Only install plugins from trusted, complete .js files downloaded fully before opening.","Inspect the plugin source for required exports (srcUrl, platform, userVariables) before distributing it.","Keep plugin files in stable storage paths, not app cache dirs that can be cleared.","Match the plugin's target API version with the app version, or enable notCheckPluginVersion deliberately."],"tags":["plugin","deep-link","local-file","validation"],"backgroundTag":"invalid-plugin-file","analyzedSha":"d118b18b3d0c904400f7eea7bf99c0ceec6c1aee","analyzedAt":"2026-08-30T11:49:12.932Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}