maotoumao/MusicFree · warning
panel.importMusicSheet.invalidLink
Error message
panel.importMusicSheet.invalidLink
What it means
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.
Source
Thrown at src/components/panels/types/importMusicSheet.tsx:75
if (result && result.length > 0) {
showDialog(
"SimpleDialog",
{
title: t("panel.importMusicSheet.prepareImport"),
content: t("panel.importMusicSheet.foundSongs", { count: result.length }),
onOk() {
showPanel(
"AddToMusicSheet",
{
musicItem:
result,
},
);
},
},
);
} else {
Toast.warn(
t("panel.importMusicSheet.invalidLink"),
);
}
},
});
}}>
<ListItem.Content title={plugin.name} />
</ListItem>
)}
/>
</View> ) : (
<NoPlugin notSupportType={t("panel.importMusicSheet.title")} />
)}
</>
)}
/>
);
}
View on GitHub (pinned to d118b18b3d)
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.
Example fix
// before
const result = await plugin.methods.importMusicSheet(text);
if (result && result.length > 0) { ... } else {
Toast.warn(t("panel.importMusicSheet.invalidLink"));
}
// after
if (!/^https?:\/\//i.test(text)) {
Toast.warn(t("panel.importMusicSheet.invalidLink"));
return;
}
const result = await plugin.methods.importMusicSheet(text);
if (result && result.length > 0) { ... } Defensive patterns
Strategy: validation
Validate before calling
const trimmed = text?.trim() ?? '';
if (!/^https?:\/\//i.test(trimmed)) {
Toast.warn(t("panel.importMusicSheet.invalidLink"));
return;
}
const result = await plugin.methods.importMusicSheet(trimmed);
if (!result || result.length === 0) {
Toast.warn(t("panel.importMusicSheet.invalidLink"));
return;
} Type guard
function isNonEmptyMusicItems(v: unknown): v is IMusic.IMusicItem[] {
return Array.isArray(v) && v.length > 0 && v.every(it => it && typeof it.id !== 'undefined');
} Try / catch
try {
const result = await plugin.methods.importMusicSheet(text);
if (isNonEmptyMusicItems(result)) { /* proceed */ }
else Toast.warn(t("panel.importMusicSheet.invalidLink"));
} catch (e) {
errorLog("importMusicSheet failed", e);
Toast.warn(t("panel.importMusicSheet.invalidLink"));
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
AI-assisted analysis of maotoumao/MusicFree@d118b18b3d (2026-08-30).
Data as JSON: /api/errors/0c8a6615688f40d9.
Report an issue: GitHub.