{"record":{"id":"385c431730515da1","repo":"Significant-Gravitas/AutoGPT","slug":"token-has-expired","errorCode":null,"errorMessage":"Token has expired","messagePattern":"Token has expired","errorType":"exception","errorClass":"ValueError","httpStatus":401,"severity":"error","filePath":"autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py","lineNumber":138,"sourceCode":"                settings.JWT_VERIFY_KEY\n                and not settings.JWT_ALGORITHM.startswith(\"HS\")\n                and algorithm == settings.JWT_ALGORITHM\n            ):\n                key = settings.JWT_VERIFY_KEY\n                algorithms = [settings.JWT_ALGORITHM]\n            else:\n                raise ValueError(f\"Invalid token: {str(e)}\") from e\n\n    try:\n        payload = jwt.decode(\n            token,\n            key,\n            algorithms=algorithms,\n            audience=audience,\n        )\n        return payload\n    except jwt.ExpiredSignatureError as e:\n        raise ValueError(\"Token has expired\") from e\n    except jwt.InvalidTokenError as e:\n        raise ValueError(f\"Invalid token: {str(e)}\") from e\n\n\ndef _get_jwks_client() -> jwt.PyJWKClient:\n    global _jwks_client, _jwks_client_url\n\n    url = get_settings().JWT_JWKS_URL\n    if _jwks_client is not None and _jwks_client_url == url:\n        return _jwks_client\n\n    with _jwks_client_lock:\n        if _jwks_client is None or _jwks_client_url != url:\n            _jwks_client = jwt.PyJWKClient(\n                url,\n                cache_keys=True,\n                lifespan=JWKS_CACHE_LIFESPAN_SECONDS,\n                # PyJWT defaults to 30s. The fetch is synchronous, so on a","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py#L120-L156","documentation":"Error \"Token has expired\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py:138 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Sign in again to obtain a new token.","Refresh the access token using the refresh token before it expires."],"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"}