BerriAI/litellm · error · ProxyException

auth_error

auth_error

Error message

Authentication Error, {e}

What it means

The /health/services endpoint sends test alerts (Slack, email) for configured integrations. Its catch-all converts any exception into a ProxyException typed auth_error; exceptions that are neither HTTPException nor ProxyException get the generic 'Authentication Error, {e}' message with code 500. Despite the label, it usually means the integration test itself failed, not that your proxy virtual key is invalid.

Source

Thrown at litellm/proxy/health_endpoints/_health_endpoints.py:486

            return {
                "status": "success",
                "message": "Mock Email Alert sent, verify Email Alert Received",
            }

    except Exception as e:
        verbose_proxy_logger.error("litellm.proxy.proxy_server.health_services_endpoint(): Exception occured - %s", e)
        verbose_proxy_logger.debug(traceback.format_exc())
        if isinstance(e, HTTPException):
            raise ProxyException(
                message=getattr(e, "detail", f"Authentication Error({e})"),
                type=ProxyErrorTypes.auth_error,
                param=getattr(e, "param", "None"),
                code=getattr(e, "status_code", status.HTTP_500_INTERNAL_SERVER_ERROR),
            )
        elif isinstance(e, ProxyException):
            raise e
        raise ProxyException(
            message="Authentication Error, " + str(e),
            type=ProxyErrorTypes.auth_error,
            param=getattr(e, "param", "None"),
            code=status.HTTP_500_INTERNAL_SERVER_ERROR,
        )


def _convert_health_check_to_dict(check) -> dict:
    """Convert health check database record to dictionary format"""
    return {
        "health_check_id": check.health_check_id,
        "model_name": check.model_name,
        "model_id": check.model_id,
        "status": check.status,
        "healthy_count": check.healthy_count,
        "unhealthy_count": check.unhealthy_count,
        "error_message": check.error_message,
        "response_time_ms": check.response_time_ms,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Configure alerting under general_settings (alerting: ['slack'], alert_types, webhook_url secret) before testing
  2. Verify the Slack webhook is live by posting to it directly with curl
  3. Set TEST_EMAIL_ADDRESS when testing the email service
  4. Read the wrapped detail - it carries the original exception text from the alerting handler, which names the real failure

Example fix

# before: testing with no alerting configured
# GET /health/services?service=slack  -> 500 Authentication Error

# after: config.yaml
general_settings:
  alerting: ['slack']
  alert_types:
    - llm_exceptions
    - db_exceptions
litellm_settings:
  callbacks: ['litellm.proxy.litellm_proxy_hooks.slack_alerting.slack_alerting']
Defensive patterns

Strategy: try-catch

Validate before calling

# Only test alerting services that are actually configured
import httpx

cfg = yaml.safe_load(open('config.yaml'))
alerting = (cfg.get('general_settings') or {}).get('alerting') or []
if 'slack' in alerting:
    httpx.get('http://localhost:4000/health/services', params={'service': 'slack'}, headers={'Authorization': f'Bearer {ADMIN_KEY}'})
else:
    print('alerting not configured - skip the test')

Try / catch

from litellm.proxy._types import ProxyException

try:
    r = admin_client.get('/health/services', params={'service': 'slack'})
    r.raise_for_status()
except ProxyException as e:
    # detail carries the alerting-handler failure; 'Authentication Error' label is generic
    log.error('alert test failed: %s', e.message)

Prevention

When it happens

Trigger: Calling GET /health/services?service=slack when Slack alerting is not configured in general_settings (the resulting 422 'not in proxy config' HTTPException is itself wrapped by this handler), or when the Slack webhook send fails; testing service=email without TEST_EMAIL_ADDRESS set.

Common situations: Operator tests alerting before adding the alerting config; SLACK_WEBHOOK_URL secret missing or the webhook revoked; SMTP/email settings incomplete; env var TEST_EMAIL_ADDRESS unset for email tests.

Understand the failure class

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/9385c7205eba6ba8. Report an issue: GitHub.