{"record":{"id":"7b7c3e5a91efc190","repo":"Mintplex-Labs/anything-llm","slug":"data-message-error-resetting-password","errorCode":null,"errorMessage":"data.message || \"Error resetting password.\"","messagePattern":"data\\.message \\|\\| \"Error resetting password\\.\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/models/system.js","lineNumber":194,"sourceCode":"          throw new Error(data.message || \"Error recovering account.\");\n        }\n        return data;\n      })\n      .catch((e) => {\n        console.error(e);\n        return { success: false, error: e.message };\n      });\n  },\n  resetPassword: async function (token, newPassword, confirmPassword) {\n    return await fetch(`${API_BASE}/system/reset-password`, {\n      method: \"POST\",\n      headers: baseHeaders(),\n      body: JSON.stringify({ token, newPassword, confirmPassword }),\n    })\n      .then(async (res) => {\n        const data = await res.json();\n        if (!res.ok) {\n          throw new Error(data.message || \"Error resetting password.\");\n        }\n        return data;\n      })\n      .catch((e) => {\n        console.error(e);\n        return { success: false, error: e.message };\n      });\n  },\n\n  checkDocumentProcessorOnline: async () => {\n    return await fetch(`${API_BASE}/system/document-processing-status`, {\n      headers: baseHeaders(),\n    })\n      .then((res) => res.ok)\n      .catch(() => false);\n  },\n  acceptedDocumentTypes: async () => {\n    return await fetch(`${API_BASE}/system/accepted-document-types`, {","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/frontend/src/models/system.js#L176-L212","documentation":"Thrown by System.resetPassword on a non-2xx POST to /api/system/reset-password with body {token, newPassword, confirmPassword}. It reads res.json() first and prefers data.message, falling back to 'Error resetting password.'. The .catch() returns {success:false, error:e.message}.","triggerScenarios":"Calling resetPassword(token, p, c) when the reset token is expired/already-used/invalid, when newPassword !== confirmPassword, when the password fails server-side complexity rules, or when the user account no longer exists.","commonSituations":"The reset token TTL elapsed before the user clicked the link; the link was clicked twice and the token was consumed on the first click; password policy was tightened and the new password does not meet it.","solutions":["Request a fresh password-reset email to get a new token.","Ensure newPassword and confirmPassword match client-side before the call.","Surface data.message — it states which policy check failed.","Confirm the user account still exists (not deleted between request and reset)."],"exampleFix":"// before\nawait System.resetPassword(token, pw, pwConfirm);\n\n// after (validate match client-side)\nif (newPassword !== confirmPassword) {\n  setError(\"Passwords do not match.\");\n  return;\n}\nconst res = await System.resetPassword(token, newPassword, confirmPassword);\nif (!res.success) setError(res.error);","handlingStrategy":"validation","validationCode":"function validResetInput(token, newPassword, confirmPassword) {\n  return typeof token === \"string\" && token.length > 0\n    && typeof newPassword === \"string\" && newPassword.length >= 8\n    && newPassword === confirmPassword;\n}","typeGuard":"/** @param {any} r @returns {r is {success:boolean}} */\nfunction isResetResult(r) { return r != null && typeof r.success === \"boolean\"; }","tryCatchPattern":"if (!validResetInput(token, pw, pwConfirm)) { setError(\"Invalid input\"); return; }\nconst res = await System.resetPassword(token, pw, pwConfirm);\nif (!isResetResult(res) || !res.success) setError(res.error);","preventionTips":["Validate newPassword === confirmPassword client-side first.","Enforce minimum length before the call.","Surface res.error — it states the failed policy."],"tags":["network","auth","password","reset"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}