maotoumao/MusicFree · warning
toast.resumePreCheckFailed
Error message
toast.resumePreCheckFailed
What it means
A localized warning toast: "Please configure in「Webdav Settings」first, then restore" (zh: 恢复前检查失败). Shown by onResumeFromWebdav when its pre-check fails: any of the WebDAV config values (webdav.url, webdav.username, webdav.password) is missing, so the function returns early without creating the WebDAV client.
Source
Thrown at src/pages/setting/settingTypes/backupSetting.tsx:140
Toast.success(t("toast.resumeSuccess"));
closePanel();
} else {
throw "无效的URL";
}
} catch (e: any) {
Toast.warn(t("toast.resumeFail", { reason: e?.message ?? e }));
}
},
});
}
async function onResumeFromWebdav() {
const url = Config.getConfig("webdav.url");
const username = Config.getConfig("webdav.username");
const password = Config.getConfig("webdav.password");
if (!(username && password && url)) {
Toast.warn(t("toast.resumePreCheckFailed"));
return;
}
const client = createClient(url, {
authType: AuthType.Password,
username: username,
password: password,
});
if (!(await client.exists("/MusicFree/MusicFreeBackup.json"))) {
Toast.warn(t("toast.backupFileNotFound"));
return;
}
try {
const resumeData = await client.getFileContents(
"/MusicFree/MusicFreeBackup.json",
{
format: "text",
View on GitHub (pinned to d118b18b3d)
Solutions
- Open WebDAV Settings in the backup/restore page and fill in the server URL, username, and password, then retry restore.
- Verify the config keys exist: Config.getConfig("webdav.url"), "webdav.username", "webdav.password" return non-empty values.
- If settings appear filled but the toast still fires, check for whitespace-only values that are truthy-safe but broken, or a config storage reset after an app update.
- Re-enter credentials if a version migration changed the webdav.* config keys.
Example fix
// before
if (!(username && password && url)) {
Toast.warn(t("toast.resumePreCheckFailed"));
return;
}
// after
if (!(username && password && url)) {
Toast.warn(t("toast.resumePreCheckFailed"));
navigation.navigate("webdavSettings"); // guide user to fix config
return;
} Defensive patterns
Strategy: validation
Validate before calling
const url = Config.getConfig("webdav.url");
const username = Config.getConfig("webdav.username");
const password = Config.getConfig("webdav.password");
const webdavConfigured =
typeof url === "string" && url.trim().length > 0 &&
typeof username === "string" && username.trim().length > 0 &&
typeof password === "string" && password.length > 0;
if (!webdavConfigured) {
Toast.warn(t("toast.resumePreCheckFailed"));
return;
} Type guard
function isNonEmptyString(v: unknown): v is string {
return typeof v === "string" && v.trim().length > 0;
} Try / catch
if (!(isNonEmptyString(url) && isNonEmptyString(username) && isNonEmptyString(password))) {
Toast.warn(t("toast.resumePreCheckFailed"));
return;
}
try {
const client = createClient(url, { authType: AuthType.Password, username, password });
} catch (e: any) {
Toast.warn(t("toast.resumeFail", { reason: e?.message ?? String(e) }));
} Prevention
- Complete WebDAV Settings (URL, username, password) before attempting any WebDAV backup/restore.
- Show the config screen directly when the pre-check fails instead of only warning.
- Trim string config values and check length, not just truthiness, to catch whitespace-only entries.
- After app updates, verify webdav.* config keys still resolve via Config.getConfig.
When it happens
Trigger: User taps restore-from-WebDAV while Config.getConfig("webdav.url"), getConfig("webdav.username") or getConfig("webdav.password") is falsy; the guard `if (!(username && password && url))` triggers the toast and returns before createClient is called.
Common situations: Fresh install where WebDAV was never configured; user cleared settings or the config keys were renamed/migrated between app versions; password field left empty; user tries restore before backup setup.
Related errors
- toast.backupFail
- toast.rememberToSave
- panel.imageViewer.saveImageFail
- toast.resumeFail
- dialog.markdownDialog.openExternalLink
AI-assisted analysis of maotoumao/MusicFree@d118b18b3d (2026-08-30).
Data as JSON: /api/errors/a3e3f8e55aa3d63c.
Report an issue: GitHub.