{"record":{"id":"8c99a9edeeeb4174","repo":"QuantumNous/new-api","slug":"failed-to-sign-out-other-sessions","errorCode":null,"errorMessage":"Failed to sign out other sessions","messagePattern":"Failed to sign out other sessions","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"web/src/features/profile/components/login-sessions-card.tsx","lineNumber":104,"sourceCode":"        (session) => session.sid === sid && session.current\n      )\n      setRevokeTarget(null)\n      if (revokedCurrent) {\n        clearAuthenticatedClientState(queryClient)\n        void navigate({ to: '/sign-in', replace: true })\n        return\n      }\n      toast.success(t('Session signed out'))\n      await queryClient.invalidateQueries({ queryKey: sessionQueryKey })\n    },\n    onError: (error: Error) => toast.error(error.message),\n  })\n\n  const revokeOthersMutation = useMutation({\n    mutationFn: async () => {\n      const response = await revokeOtherLoginSessions()\n      if (!response.success) {\n        throw new Error(\n          response.message || t('Failed to sign out other sessions')\n        )\n      }\n    },\n    onSuccess: async () => {\n      setConfirmOthers(false)\n      toast.success(t('Other sessions signed out'))\n      await queryClient.invalidateQueries({ queryKey: sessionQueryKey })\n    },\n    onError: (error: Error) => toast.error(error.message),\n  })\n\n  const sessions = sessionsQuery.data ?? []\n  const hasOtherSessions = sessions.some((session) => !session.current)\n  let sessionsContent: ReactNode\n  if (sessionsQuery.isLoading) {\n    sessionsContent = (\n      <div className='flex flex-col gap-3'>","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/QuantumNous/new-api/blob/e2c7aa7b102c2075eae2377df3508658d45e88dc/web/src/features/profile/components/login-sessions-card.tsx#L86-L122","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Re-authenticate if the token is stale, then retry the action from the Login Sessions card.","Verify Redis/session-store connectivity on the backend if the endpoint consistently returns 500.","Retry once after the sessions query refetches, in case the list and server state diverged."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"onError: (error: Error) => {\n  toast.error(error.message || t('Failed to sign out other sessions'))\n  void queryClient.invalidateQueries({ queryKey: sessionQueryKey })\n}","preventionTips":["Refresh the sessions list immediately before the bulk action so server and UI agree.","Give revokeOtherLoginSessions a single automatic retry with backoff for transient store errors.","Run bulk revoke only from an authenticated, non-expired admin/user session."],"tags":["auth","session-management","tanstack-query","api-error"],"backgroundTag":null,"analyzedSha":"e2c7aa7b102c2075eae2377df3508658d45e88dc","analyzedAt":"2026-08-15T10:35:18.111Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}