{"record":{"id":"20b6b4539f82879b","repo":"maotoumao/MusicFree","slug":"toast-backupfilenotfound","errorCode":null,"errorMessage":"toast.backupFileNotFound","messagePattern":"toast\\.backupFileNotFound","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/pages/setting/settingTypes/backupSetting.tsx","lineNumber":150,"sourceCode":"    }\r\n\r\n    async function onResumeFromWebdav() {\r\n        const url = Config.getConfig(\"webdav.url\");\r\n        const username = Config.getConfig(\"webdav.username\");\r\n        const password = Config.getConfig(\"webdav.password\");\r\n\r\n        if (!(username && password && url)) {\r\n            Toast.warn(t(\"toast.resumePreCheckFailed\"));\r\n            return;\r\n        }\r\n        const client = createClient(url, {\r\n            authType: AuthType.Password,\r\n            username: username,\r\n            password: password,\r\n        });\r\n\r\n        if (!(await client.exists(\"/MusicFree/MusicFreeBackup.json\"))) {\r\n            Toast.warn(t(\"toast.backupFileNotFound\"));\r\n            return;\r\n        }\r\n\r\n        try {\r\n            const resumeData = await client.getFileContents(\r\n                \"/MusicFree/MusicFreeBackup.json\",\r\n                {\r\n                    format: \"text\",\r\n                },\r\n            );\r\n            await Backup.resume(\r\n                resumeData,\r\n                Config.getConfig(\"backup.resumeMode\"),\r\n            );\r\n            Toast.success(t(\"toast.resumeSuccess\"));\r\n        } catch (e: any) {\r\n            Toast.warn(t(\"toast.resumeFail\", { reason: e?.message ?? e }));\r\n        }\r","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/maotoumao/MusicFree/blob/d118b18b3d0c904400f7eea7bf99c0ceec6c1aee/src/pages/setting/settingTypes/backupSetting.tsx#L132-L168","documentation":"Not a thrown exception but a user-facing warning toast in onResumeFromWebdav (backupSetting.tsx:150). It fires when the WebDAV server responds successfully but does not contain the expected backup file at /MusicFree/MusicFreeBackup.json, so resume is aborted early. The app deliberately guards the resume flow instead of letting getFileContents throw a generic 404.","triggerScenarios":"User taps 'resume from WebDAV' while webdav.url/username/password are configured and reachable, but client.exists('/MusicFree/MusicFreeBackup.json') returns false — no backup has ever been uploaded, it was deleted on the server, or it is stored under a different path.","commonSituations":"Fresh WebDAV account used before the first backup; backup stored manually under a custom path like /backups/xxx.json; server URL pointing to a different account/root directory than the one used when backing up; file removed by server-side cleanup.","solutions":["Run 'backup to WebDAV' once to upload /MusicFree/MusicFreeBackup.json, then retry resume","Verify webdav.url points to the same account/root where the backup was written","Check the server (web UI) that /MusicFree/MusicFreeBackup.json exists at the exact root-relative path","Re-create the file manually on the server with the JSON produced by Backup.backup()"],"exampleFix":"// before\nif (!(await client.exists(\"/MusicFree/MusicFreeBackup.json\"))) {\n    Toast.warn(t(\"toast.backupFileNotFound\"));\n    return;\n}\n// after\nconst backupPath = Config.getConfig(\"webdav.backupPath\") ?? \"/MusicFree/MusicFreeBackup.json\";\nif (!(await client.exists(backupPath))) {\n    await onBackupToWebdav(); // auto-upload a backup before resuming\n    if (!(await client.exists(backupPath))) {\n        Toast.warn(t(\"toast.backupFileNotFound\"));\n        return;\n    }\n}","handlingStrategy":"validation","validationCode":"const backupPath = \"/MusicFree/MusicFreeBackup.json\";\nif (!(await client.exists(backupPath))) {\n    Toast.warn(t(\"toast.backupFileNotFound\"));\n    return;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run 'backup to WebDAV' before attempting resume","Keep the backup path constant (/MusicFree/MusicFreeBackup.json) across devices","Check the file exists in the server web UI when the toast appears"],"tags":["webdav","missing-file","backup","precheck"],"backgroundTag":"remote-file-not-found","analyzedSha":"d118b18b3d0c904400f7eea7bf99c0ceec6c1aee","analyzedAt":"2026-08-30T11:49:12.932Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}