Mintplex-Labs/anything-llm · error · Error

data.message || "Error resetting password."

Error message

data.message || "Error resetting password."

What it means

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}.

Source

Thrown at frontend/src/models/system.js:194

          throw new Error(data.message || "Error recovering account.");
        }
        return data;
      })
      .catch((e) => {
        console.error(e);
        return { success: false, error: e.message };
      });
  },
  resetPassword: async function (token, newPassword, confirmPassword) {
    return await fetch(`${API_BASE}/system/reset-password`, {
      method: "POST",
      headers: baseHeaders(),
      body: JSON.stringify({ token, newPassword, confirmPassword }),
    })
      .then(async (res) => {
        const data = await res.json();
        if (!res.ok) {
          throw new Error(data.message || "Error resetting password.");
        }
        return data;
      })
      .catch((e) => {
        console.error(e);
        return { success: false, error: e.message };
      });
  },

  checkDocumentProcessorOnline: async () => {
    return await fetch(`${API_BASE}/system/document-processing-status`, {
      headers: baseHeaders(),
    })
      .then((res) => res.ok)
      .catch(() => false);
  },
  acceptedDocumentTypes: async () => {
    return await fetch(`${API_BASE}/system/accepted-document-types`, {

View on GitHub (pinned to 526360e320)

Solutions

  1. Request a fresh password-reset email to get a new token.
  2. Ensure newPassword and confirmPassword match client-side before the call.
  3. Surface data.message — it states which policy check failed.
  4. Confirm the user account still exists (not deleted between request and reset).

Example fix

// before
await System.resetPassword(token, pw, pwConfirm);

// after (validate match client-side)
if (newPassword !== confirmPassword) {
  setError("Passwords do not match.");
  return;
}
const res = await System.resetPassword(token, newPassword, confirmPassword);
if (!res.success) setError(res.error);
Defensive patterns

Strategy: validation

Validate before calling

function validResetInput(token, newPassword, confirmPassword) {
  return typeof token === "string" && token.length > 0
    && typeof newPassword === "string" && newPassword.length >= 8
    && newPassword === confirmPassword;
}

Type guard

/** @param {any} r @returns {r is {success:boolean}} */
function isResetResult(r) { return r != null && typeof r.success === "boolean"; }

Try / catch

if (!validResetInput(token, pw, pwConfirm)) { setError("Invalid input"); return; }
const res = await System.resetPassword(token, pw, pwConfirm);
if (!isResetResult(res) || !res.success) setError(res.error);

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/7b7c3e5a91efc190. Report an issue: GitHub.