maotoumao/MusicFree · warning

panel.associateLrc.toast.fail

Error message

panel.associateLrc.toast.fail

What it means

Generic failure toast for the lyric-association flow in AssociateLrc. Any exception thrown while parsing the key or calling lyricManager.associateLyric lands in the catch at associateLrc.tsx:64-69; unless it is the sentinel 'CLIPBOARD TIMEOUT' (error 26), this warning is shown and the error is written via errorLog. The lyric was not associated.

Solutions

  1. Check errorLog output ('关联歌词失败') for the underlying message to identify parse vs. association failure.
  2. Paste a valid media unique key produced by the app, not arbitrary text.
  3. Ensure musicItem passed to the panel is a complete IMusic.IMusicItem (id, platform, etc.).
  4. Retry after re-caching the target media (see error 26) if the key was valid but its data was stale.

Example fix

// before
} catch (e: any) {
    if (e.message !== "CLIPBOARD TIMEOUT") {
        Toast.warn(t("panel.associateLrc.toast.fail"));
    }
// after
} catch (e: any) {
    if (e.message !== "CLIPBOARD TIMEOUT") {
        if (parseMediaUniqueKeySafe(input)) {
            Toast.warn(t("panel.associateLrc.toast.fail"));
        } else {
            Toast.warn(t("panel.associateLrc.invalidKey"));
        }
    }
Defensive patterns

Strategy: try-catch

Validate before calling

const text = (input ?? (await Clipboard.getString()))?.trim();
if (!text || !/^\S+$/.test(text)) {
    // not a plausible media key — treat as unlink or abort
    return;
}

Type guard

function isMediaUniqueKey(v: unknown): v is string {
    return typeof v === 'string' && v.length > 0 && v.includes('#');
}

Try / catch

try {
    const targetMedia = parseMediaUniqueKey(text);
    lyricManager.associateLyric(musicItem, { ...targetMedia, ...mediaCache.getMediaCache(targetMedia)! });
} catch (e: any) {
    errorLog("关联歌词失败", e?.message);
    Toast.warn(t("panel.associateLrc.toast.fail"));
}

Prevention

When it happens

Trigger: parseMediaUniqueKey(inputValue.trim()) throws on malformed clipboard/input text (associateLrc.tsx:44-46), or lyricManager.associateLyric(musicItem, {...}) rejects (invalid musicItem or merged media object at :58-61).

Common situations: Clipboard contains random text that is not a valid media unique key; clipboard read permission denied making input empty-ish; associateLyric called with a musicItem missing required fields; corrupted cache data merged into the association payload.

Related errors


AI-assisted analysis of maotoumao/MusicFree@d118b18b3d (2026-08-30). Data as JSON: /api/errors/25a2f2988e49fae5. Report an issue: GitHub.

Appendix: source

Thrown at src/components/panels/types/associateLrc.tsx:66

                                    const targetCache =
                                        mediaCache.getMediaCache(targetMedia);
                                    if (!targetCache) {
                                        Toast.warn(
                                            t("panel.associateLrc.targetExpired"),
                                        );
                                        // TODO: ERROR CODE
                                        throw new Error("CLIPBOARD TIMEOUT");
                                    }

                                    lyricManager.associateLyric(musicItem, {
                                        ...targetMedia,
                                        ...targetCache,
                                    });
                                    Toast.success(t("panel.associateLrc.toast.success"));
                                    hidePanel();
                                } catch (e: any) {
                                    if (e.message !== "CLIPBOARD TIMEOUT") {
                                        Toast.warn(t("panel.associateLrc.toast.fail"));
                                    }
                                    errorLog("关联歌词失败", e?.message);
                                }
                            } else {
                                lyricManager.unassociateLyric(musicItem);
                                Toast.success(t("panel.associateLrc.toast.unlinkSuccess"));
                                hidePanel();
                            }
                        }}
                    />

                    <TextInput
                        value={input}
                        onChangeText={_ => {
                            setInput(_);
                        }}
                        style={[
                            style.input,

View on GitHub (pinned to d118b18b3d)