QuantumNous/new-api · warning · Error

Failed to sign out other sessions

Error message

Failed to sign out other sessions

What it means

Thrown by the revoke-others mutation when revokeOtherLoginSessions() rejects or returns success=false. It is the bulk variant of the single-session revoke: it asks the server to sign out every session except the current one. The thrown message is shown as an error toast in onError.

Source

Thrown at web/src/features/profile/components/login-sessions-card.tsx:104

        (session) => session.sid === sid && session.current
      )
      setRevokeTarget(null)
      if (revokedCurrent) {
        clearAuthenticatedClientState(queryClient)
        void navigate({ to: '/sign-in', replace: true })
        return
      }
      toast.success(t('Session signed out'))
      await queryClient.invalidateQueries({ queryKey: sessionQueryKey })
    },
    onError: (error: Error) => toast.error(error.message),
  })

  const revokeOthersMutation = useMutation({
    mutationFn: async () => {
      const response = await revokeOtherLoginSessions()
      if (!response.success) {
        throw new Error(
          response.message || t('Failed to sign out other sessions')
        )
      }
    },
    onSuccess: async () => {
      setConfirmOthers(false)
      toast.success(t('Other sessions signed out'))
      await queryClient.invalidateQueries({ queryKey: sessionQueryKey })
    },
    onError: (error: Error) => toast.error(error.message),
  })

  const sessions = sessionsQuery.data ?? []
  const hasOtherSessions = sessions.some((session) => !session.current)
  let sessionsContent: ReactNode
  if (sessionsQuery.isLoading) {
    sessionsContent = (
      <div className='flex flex-col gap-3'>

View on GitHub (pinned to e2c7aa7b10)

Solutions

  1. Check the network response body for the server's response.message; it identifies whether it is an auth failure (401), a store failure (500), or a network error.
  2. Re-authenticate if the token is stale, then retry the action from the Login Sessions card.
  3. Verify Redis/session-store connectivity on the backend if the endpoint consistently returns 500.
  4. Retry once after the sessions query refetches, in case the list and server state diverged.
Defensive patterns

Strategy: retry

Try / catch

onError: (error: Error) => {
  toast.error(error.message || t('Failed to sign out other sessions'))
  void queryClient.invalidateQueries({ queryKey: sessionQueryKey })
}

Prevention

When it happens

Trigger: POST to the 'revoke all other sessions' endpoint with an invalid/expired auth token, a read-only or unavailable session store, a server-side 5xx while iterating sessions, or a network failure.

Common situations: User clicks 'sign out other sessions' right after their token expired; multi-node deployment where the session store is inconsistent; database/Redis outage; password-change flows that race with this call and already invalidated sessions.

Related errors


AI-assisted analysis of QuantumNous/new-api@e2c7aa7b10 (2026-08-15). Data as JSON: /api/errors/8c99a9edeeeb4174. Report an issue: GitHub.