Where Errors Happen

Most errors are self-explanatory from their code. The table below maps each to its cause and fix.

Error Response Format

{
  "code": "ERROR_CODE",
  "message": "Human-readable description"
}

Error Code Reference

CodeHTTPWhat went wrongHow to fix it
INVALID_ATTESTATION401JWT is malformed, expired, wrong aud, or replayed jtiGenerate a fresh attestation. Check aud matches the endpoint URL.
AGENT_NOT_REGISTERED403Agent hasn’t registered yetCall /ath/agents/register first
AGENT_UNAPPROVED403Registration is pending or deniedWait for approval or request with different scopes
PROVIDER_NOT_APPROVED403Agent isn’t approved for this providerRegister with this provider
SCOPE_NOT_APPROVED403Requested scopes exceed what’s approvedRequest only scopes you were approved for
SESSION_NOT_FOUND400Unknown ath_session_idUse the session from your most recent authorize call
SESSION_EXPIRED400Session is older than 10 minutesCall authorize again — sessions are short-lived
STATE_MISMATCH400OAuth state doesn’t matchDon’t reuse state values
TOKEN_INVALID401Token not recognizedGet a new token
TOKEN_EXPIRED401Token past its expires_inRe-authorize and get a new token
TOKEN_REVOKED401Token was revokedRe-authorize and get a new token
AGENT_IDENTITY_MISMATCH403Attestation sub ≠ registered agentCheck your agentId matches what you registered with
PROVIDER_MISMATCH403Token was issued for a different providerUse the token only for the provider it was issued for
USER_DENIED403User clicked “Deny” on consent pageUser declined — respect their decision
OAUTH_ERROR502Upstream OAuth provider returned an errorCheck provider configuration
INTERNAL_ERROR500Server bugReport to service operator

Common Mistakes

The attestation for the token endpoint must have aud set to the full token endpoint URL (e.g., https://example.com/ath/token), not the base URL. The SDK handles this automatically — if you’re getting this error with the SDK, check that your url config is correct.
ATH sessions expire after 10 minutes. If the user takes too long to approve (or you wait too long after they approve), the session expires. Call authorize again to get a fresh session.
Each ATH token is bound to one provider. If you got a token for github and try to use it for slack, you’ll get this error. Get a separate token for each provider.