moeru-ai/airi · error · Error

changePassword failed

Error message

changePassword failed

What it means

The password-change handler wraps better-auth's authClient.changePassword (with revokeOtherSessions: true); the literal fires only when the returned error has no message. Real causes: wrong currentPassword, a new password violating server policy, or an expired session.

Solutions

  1. Verify currentPassword and confirm the new password meets the server policy.
  2. Log error.status/code from changePassword to distinguish invalid-password from session errors.
  3. Re-login on 401 and retry.
  4. Ensure the auth app is reachable at SERVER_URL.

Example fix

// before
if (error)
  throw new Error(error.message ?? 'changePassword failed')

// after
if (error)
  throw new Error(error.message ?? `changePassword failed (${error.status ?? 'no status'} ${error.code ?? ''})`)
Defensive patterns

Strategy: try-catch

Validate before calling

if (passwordForm.next !== passwordForm.confirm)
  return // block submit
if (passwordForm.next.length < 8)
  return // block submit
if (passwordForm.next === passwordForm.current) {
  passwordError.value = t('settings.pages.account.security.error.passwordSameAsCurrent')
  return
}

Try / catch

catch (error) {
  const msg = errorMessageFrom(error) ?? ''
  if (msg.toLowerCase().includes('invalid password'))
    passwordError.value = 'Current password is incorrect'
  else if ((error as { status?: number })?.status === 401)
    await redirectToSignIn()
  else
    passwordError.value = msg || t('settings.pages.account.security.error.fallback')
}

Prevention

When it happens

Trigger: currentPassword mismatch (server rejects with an invalid-password style error); newPassword below the server's minimum policy; 401 from an expired session; auth server unreachable.

Common situations: Typo in the current password; password managers autofilling wrong fields; server password policy stricter than the client expects.

Related errors


AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18). Data as JSON: /api/errors/5f101a02a428bb16. Report an issue: GitHub.

Appendix: source

Thrown at packages/stage-pages/src/pages/settings/account/account-settings-page.vue:277

  if (passwordForm.next !== passwordForm.confirm) {
    passwordError.value = t('settings.pages.account.security.error.passwordMismatch')
    return
  }
  if (passwordForm.next === passwordForm.current) {
    passwordError.value = t('settings.pages.account.security.error.passwordSameAsCurrent')
    return
  }

  passwordLoading.value = true
  try {
    const { error } = await authClient.changePassword({
      currentPassword: passwordForm.current,
      newPassword: passwordForm.next,
      revokeOtherSessions: true,
    })
    if (error)
      throw new Error(error.message ?? 'changePassword failed')

    passwordForm.current = ''
    passwordForm.next = ''
    passwordForm.confirm = ''
    passwordSuccess.value = t('settings.pages.account.security.message.changed')
    trackPasswordChanged()
  }
  catch (error) {
    passwordError.value = errorMessageFrom(error) ?? t('settings.pages.account.security.error.fallback')
  }
  finally {
    passwordLoading.value = false
  }
}

async function handleSendSetPasswordLink() {
  const email = userEmail.value
  if (setPasswordLoading.value || !email)

View on GitHub (pinned to 677329427f)