{"record":{"id":"0c8a6615688f40d9","repo":"maotoumao/MusicFree","slug":"panel-importmusicsheet-invalidlink","errorCode":null,"errorMessage":"panel.importMusicSheet.invalidLink","messagePattern":"panel\\.importMusicSheet\\.invalidLink","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/panels/types/importMusicSheet.tsx","lineNumber":75,"sourceCode":"                                                    if (result && result.length > 0) {\r\n                                                        showDialog(\r\n                                                            \"SimpleDialog\",\r\n                                                            {\r\n                                                                title: t(\"panel.importMusicSheet.prepareImport\"),\r\n                                                                content: t(\"panel.importMusicSheet.foundSongs\", { count: result.length }),\r\n                                                                onOk() {\r\n                                                                    showPanel(\r\n                                                                        \"AddToMusicSheet\",\r\n                                                                        {\r\n                                                                            musicItem:\r\n                                                                                result,\r\n                                                                        },\r\n                                                                    );\r\n                                                                },\r\n                                                            },\r\n                                                        );                                                    \n                                                    } else {\r\n                                                        Toast.warn(\r\n                                                            t(\"panel.importMusicSheet.invalidLink\"),\r\n                                                        );\r\n                                                    }\r\n                                                },\r\n                                            });\r\n                                        }}>\r\n                                        <ListItem.Content title={plugin.name} />\r\n                                    </ListItem>\r\n                                )}\r\n                            />\r\n                        </View>                    ) : (\r\n                        <NoPlugin notSupportType={t(\"panel.importMusicSheet.title\")} />\r\n                    )}\r\n                </>\r\n            )}\r\n        />\r\n    );\r\n}\r","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/maotoumao/MusicFree/blob/d118b18b3d0c904400f7eea7bf99c0ceec6c1aee/src/components/panels/types/importMusicSheet.tsx#L57-L93","documentation":"Shown by the ImportMusicSheet panel when a plugin's importMusicSheet method resolves but returns null/undefined or an empty array (importMusicSheet.tsx:57-78). It means the plugin could not extract any songs from the supplied link — typically because the link is not a recognized/valid playlist URL for that plugin, or the remote source returned nothing.","triggerScenarios":"onOk of the SimpleInput panel calls plugin.methods.importMusicSheet(text); the result fails the `result && result.length > 0` check — link unsupported by the plugin, private/expired playlist, network response with zero tracks, or wrong domain pasted.","commonSituations":"Pasting a playlist URL from an unsupported domain; importing a private or deleted playlist; plugin's upstream API changed and returns empty results; typo in the link or pasting a song link where a sheet link is required.","solutions":["Verify the pasted link matches the plugin's documented format (see the input's hints: plugin.instance.hints?.importMusicSheet).","Ensure the playlist is public and accessible; open the URL in a browser to confirm.","Try a different plugin that supports importMusicSheet for that source.","Update or reinstall the plugin — upstream API changes can silently yield empty results.","Check network connectivity; some plugins return empty rather than throwing on fetch failure."],"exampleFix":"// before\nconst result = await plugin.methods.importMusicSheet(text);\nif (result && result.length > 0) { ... } else {\n    Toast.warn(t(\"panel.importMusicSheet.invalidLink\"));\n}\n// after\nif (!/^https?:\\/\\//i.test(text)) {\n    Toast.warn(t(\"panel.importMusicSheet.invalidLink\"));\n    return;\n}\nconst result = await plugin.methods.importMusicSheet(text);\nif (result && result.length > 0) { ... }","handlingStrategy":"validation","validationCode":"const trimmed = text?.trim() ?? '';\nif (!/^https?:\\/\\//i.test(trimmed)) {\n    Toast.warn(t(\"panel.importMusicSheet.invalidLink\"));\n    return;\n}\nconst result = await plugin.methods.importMusicSheet(trimmed);\nif (!result || result.length === 0) {\n    Toast.warn(t(\"panel.importMusicSheet.invalidLink\"));\n    return;\n}","typeGuard":"function isNonEmptyMusicItems(v: unknown): v is IMusic.IMusicItem[] {\n    return Array.isArray(v) && v.length > 0 && v.every(it => it && typeof it.id !== 'undefined');\n}","tryCatchPattern":"try {\n    const result = await plugin.methods.importMusicSheet(text);\n    if (isNonEmptyMusicItems(result)) { /* proceed */ }\n    else Toast.warn(t(\"panel.importMusicSheet.invalidLink\"));\n} catch (e) {\n    errorLog(\"importMusicSheet failed\", e);\n    Toast.warn(t(\"panel.importMusicSheet.invalidLink\"));\n}","preventionTips":["Check the plugin's hints.importMusicSheet for accepted link formats before pasting.","Only import public, reachable playlists.","Keep plugins updated to match upstream API changes.","Wrap plugin calls in try-catch — plugins may throw or return empty."],"tags":["plugin","import","url-validation","empty-result"],"backgroundTag":"invalid-playlist-url","analyzedSha":"d118b18b3d0c904400f7eea7bf99c0ceec6c1aee","analyzedAt":"2026-08-30T11:49:12.932Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}