{"record":{"id":"d0c0e2f1d540c6fe","repo":"maotoumao/MusicFree","slug":"panel-musicitemlyricoptions-deletefail","errorCode":null,"errorMessage":"panel.musicItemLyricOptions.deleteFail","messagePattern":"panel\\.musicItemLyricOptions\\.deleteFail","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/components/panels/types/musicItemLyricOptions.tsx","lineNumber":191,"sourceCode":"                    hidePanel();\r\n                } catch (e: any) {\r\n                    console.log(e);\r\n                    Toast.warn(t(\"panel.musicItemLyricOptions.settingFail\", {\r\n                        reason: e?.message,\r\n                    }));\r\n                }\r\n            },\r\n        },\r\n        {\r\n            icon: \"trash-outline\",\r\n            title: t(\"panel.musicItemLyricOptions.deleteLocalLyric\"),\r\n            async onPress() {\r\n                try {\r\n                    lyricManager.removeLocalLyric(musicItem);\r\n                    hidePanel();\r\n                } catch (e: any) {\r\n                    console.log(e);\r\n                    Toast.warn(t(\"panel.musicItemLyricOptions.deleteFail\", {\r\n                        reason: e?.message,\r\n                    }));\r\n                }\r\n            },\r\n        },\r\n    ];\r\n\r\n    return (\r\n        <PanelBase\r\n            renderBody={() => (\r\n                <>\r\n                    <View style={style.header}>\r\n                        <FastImage\r\n                            style={style.artwork}\r\n                            source={musicItem?.artwork}\r\n                            placeholderSource={ImgAsset.albumDefault}\r\n                        />\r\n                        <View style={style.content}>\r","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/maotoumao/MusicFree/blob/d118b18b3d0c904400f7eea7bf99c0ceec6c1aee/src/components/panels/types/musicItemLyricOptions.tsx#L173-L209","documentation":"Toast shown when removing a locally-associated lyric fails. onPress calls lyricManager.removeLocalLyric(musicItem) synchronously; a thrown exception (missing file, media library error, invalid musicItem) is caught and shown as this toast with reason.","triggerScenarios":"Pressing 'delete lyric' for a track when removeLocalLyric throws — e.g. the lyric file was already deleted externally, the musicItem has no associated local lyric metadata, or filesystem permissions block deletion.","commonSituations":"User manually deleted the .lrc file from storage so removal targets a missing file; permission errors on app storage; corrupt lyric metadata in the media library.","solutions":["Check console.log(e) and the toast reason for the underlying exception","Verify the local lyric file still exists / clean up stale lyric metadata in the media library","Grant the app storage permissions and retry","Re-associate the lyric then delete again if metadata is corrupt"],"exampleFix":"// before\nlyricManager.removeLocalLyric(musicItem);\n// after\ntry {\n    lyricManager.removeLocalLyric(musicItem);\n} catch (e) {\n    // tolerate missing-file: treat as already removed\n    console.warn('removeLocalLyric failed', e);\n}","handlingStrategy":"try-catch","validationCode":"// removal can fail on missing files; verify association first\nconst hasLocal = musicItem?.$localLyric != null; // adjust to your metadata source","typeGuard":"function canRemoveLyric(m: any): boolean {\n    return !!m && typeof m.id !== 'undefined';\n}","tryCatchPattern":"try {\n    lyricManager.removeLocalLyric(musicItem);\n    hidePanel();\n} catch (e: any) {\n    console.warn(e);\n    Toast.warn(t('panel.musicItemLyricOptions.deleteFail', { reason: e?.message }));\n}","preventionTips":["Treat missing-file errors as success (idempotent delete)","Keep storage permissions granted","Refresh lyric metadata if it becomes stale"],"tags":["lyrics","file-deletion"],"backgroundTag":"local-lyric-remove-failed","analyzedSha":"d118b18b3d0c904400f7eea7bf99c0ceec6c1aee","analyzedAt":"2026-08-30T11:49:12.932Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}