{"record":{"id":"5bb7d757e5574533","repo":"Significant-Gravitas/AutoGPT","slug":"user-id-not-found-in-token","errorCode":null,"errorMessage":"User ID not found in token","messagePattern":"User ID not found in token","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py","lineNumber":172,"sourceCode":"                cache_keys=True,\n                lifespan=JWKS_CACHE_LIFESPAN_SECONDS,\n                # PyJWT defaults to 30s. The fetch is synchronous, so on a\n                # cache miss that is 30s of a worker doing nothing — bound it\n                # to something closer to \"the frontend is briefly redeploying\".\n                timeout=JWKS_FETCH_TIMEOUT_SECONDS,\n            )\n            _jwks_client_url = url\n    return _jwks_client\n\n\ndef verify_user(jwt_payload: dict | None, admin_only: bool) -> User:\n    if jwt_payload is None:\n        raise HTTPException(status_code=401, detail=\"Authorization header is missing\")\n\n    user_id = jwt_payload.get(\"sub\")\n\n    if not user_id:\n        raise HTTPException(status_code=401, detail=\"User ID not found in token\")\n\n    if admin_only and jwt_payload.get(\"role\") != \"admin\":\n        raise HTTPException(status_code=403, detail=\"Admin access required\")\n\n    return User.from_payload(jwt_payload)\n","sourceCodeStart":154,"sourceCodeEnd":178,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py#L154-L178","documentation":"Error \"User ID not found in token\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the token payload includes the user ID (sub) claim; re-issue the token from the auth provider.","Verify the token was minted by the expected issuer with the correct claims."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}