Athena

Troubleshooting

Map 401, 403, and 503 failures back to the exact gateway API key checks that produced them.

When a gateway key fails, Athena usually tells you which stage failed. This page maps those failures back to the runtime implementation.

Fast triage

Common failures

SymptomLikely causeWhat to check
API key requiredenforcement is on and no key was presentedX-Athena-Key, client override, global enforcement
Invalid API keybad format, unknown public_id, or secret mismatchplaintext key shape, creation output, copy/paste errors
Inactive API keyis_active = falsePATCH /admin/api-keys/{id} state
Expired API keyexpires_at is in the pastexpiration timestamp and clock skew
API key client mismatchkey bound to another clientclient_name on the key and X-Athena-Client on the request
Insufficient API key rightsmissing required rightgranted rights, wildcard behavior, route requirement
IP blockedblacklist matchglobal blacklist and per-key blacklist
IP not allowedwhitelist exists and caller is not in itglobal whitelist, per-key whitelist, virgin lock-in outcome
Client IP requiredIP rules exist but Athena cannot resolve the caller IPX-Real-IP, trusted X-Forwarded-For, reverse proxy config
API key validation unavailableauth store lookup failedauth client connectivity, pool saturation, fail mode
API key policy unavailableenforcement lookup failedauth client connectivity, api_key_config access, fail mode

Inspect the stored record

curl "http://localhost:4052/admin/api-keys" \
  -H "X-Athena-Admin-Key: $ATHENA_KEY_12"

Confirm:

  • public_id matches the presented key prefix
  • client_name matches the request client
  • is_active is true
  • expires_at is still in the future
  • the required rights are granted

Inspect IP policy and learning state

curl "http://localhost:4052/admin/api-keys/$API_KEY_ID/ip-policy" \
  -H "X-Athena-Admin-Key: $ATHENA_KEY_12"

curl "http://localhost:4052/admin/api-keys/$API_KEY_ID/ip-seen?limit=100" \
  -H "X-Athena-Admin-Key: $ATHENA_KEY_12"

Use these responses to answer:

  • Is the key still unresolved in virgin_mode?
  • Which whitelist and blacklist entries currently apply?
  • Did Athena lock in more or fewer hosts than expected?
  • Are the learned rows marked locked_in?

Inspect enforcement configuration

curl "http://localhost:4052/admin/api-key-config" \
  -H "X-Athena-Admin-Key: $ATHENA_KEY_12"

curl "http://localhost:4052/admin/api-key-clients" \
  -H "X-Athena-Admin-Key: $ATHENA_KEY_12"

Remember that:

  • global enforcement lives in api_key_config
  • client overrides live in api_key_client_config
  • enforcement decisions are cached briefly, so changes may take about two seconds to settle

Use the auth logs

Athena writes request-level auth outcomes into api_key_auth_log. This is the best place to confirm the internal failure reason code, granted rights, and whether the request was authenticated versus authorized.

Useful fields include:

  • api_key_public_id
  • client_name
  • required_rights
  • granted_rights
  • authenticated
  • authorized
  • enforced
  • failure_reason
  • remote_addr

503-specific guidance

If you see 503s with auth-related messages, check:

  1. the Postgres pool for gateway.auth_client
  2. whether gateway.auth_client and gateway.logging_client point at the same saturated database
  3. whether gateway.api_key_fail_mode is still fail_closed

If the errors coincide with pool timeouts, also read Gateway Pool Starvation And Auth Failures.