Significant-Gravitas/AutoGPT · error · ValueError

Token has expired

Error message

Token has expired

What it means

Error "Token has expired" thrown in Significant-Gravitas/AutoGPT.

Source

Thrown at autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py:138

                settings.JWT_VERIFY_KEY
                and not settings.JWT_ALGORITHM.startswith("HS")
                and algorithm == settings.JWT_ALGORITHM
            ):
                key = settings.JWT_VERIFY_KEY
                algorithms = [settings.JWT_ALGORITHM]
            else:
                raise ValueError(f"Invalid token: {str(e)}") from e

    try:
        payload = jwt.decode(
            token,
            key,
            algorithms=algorithms,
            audience=audience,
        )
        return payload
    except jwt.ExpiredSignatureError as e:
        raise ValueError("Token has expired") from e
    except jwt.InvalidTokenError as e:
        raise ValueError(f"Invalid token: {str(e)}") from e


def _get_jwks_client() -> jwt.PyJWKClient:
    global _jwks_client, _jwks_client_url

    url = get_settings().JWT_JWKS_URL
    if _jwks_client is not None and _jwks_client_url == url:
        return _jwks_client

    with _jwks_client_lock:
        if _jwks_client is None or _jwks_client_url != url:
            _jwks_client = jwt.PyJWKClient(
                url,
                cache_keys=True,
                lifespan=JWKS_CACHE_LIFESPAN_SECONDS,
                # PyJWT defaults to 30s. The fetch is synchronous, so on a

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Sign in again to obtain a new token.
  2. Refresh the access token using the refresh token before it expires.

When it happens

Trigger: Thrown at autogpt_platform/autogpt_libs/autogpt_libs/auth/jwt_utils.py:138 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/385c431730515da1. Report an issue: GitHub.