BerriAI/litellm · error · ValueError
Missing SLACK_WEBHOOK_URL from environment
Error message
Missing SLACK_WEBHOOK_URL from environment
What it means
For alert types configured with digest mode, litellm resolves a webhook URL (per-alert mapping, then default_webhook_url, then SLACK_WEBHOOK_URL env) before enqueueing a digest entry; if all three are None it raises ValueError (litellm/integrations/SlackAlerting/slack_alerting.py:1345).
Source
Thrown at litellm/integrations/SlackAlerting/slack_alerting.py:1345
return
if alert_type not in self.alert_types:
return
from datetime import datetime
# Check if digest mode is enabled for this alert type
alert_type_name_str: Final = getattr(alert_type, "value", str(alert_type))
_atc: Final = self.alert_type_config.get(alert_type_name_str)
if _atc is not None and _atc.digest:
# Resolve webhook URL for this alert type (needed for digest entry)
if self.alert_to_webhook_url is not None and alert_type in self.alert_to_webhook_url:
_digest_webhook: str | list[str] | None = self.alert_to_webhook_url[alert_type]
elif self.default_webhook_url is not None:
_digest_webhook = self.default_webhook_url
else:
_digest_webhook = os.getenv("SLACK_WEBHOOK_URL", None)
if _digest_webhook is None:
raise ValueError("Missing SLACK_WEBHOOK_URL from environment")
digest_key: Final = f"{alert_type_name_str}:{request_model or ''}:{api_base or ''}"
async with self.digest_lock:
now: Final = datetime.now()
if digest_key in self.digest_buckets:
self.digest_buckets[digest_key]["count"] += 1
self.digest_buckets[digest_key]["last_time"] = now
else:
self.digest_buckets[digest_key] = DigestEntry(
alert_type=alert_type_name_str,
request_model=request_model or "",
api_base=api_base or "",
first_message=message,
level=level,
count=1,
start_time=now,
last_time=now,View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set SLACK_WEBHOOK_URL in the proxy environment
- Or configure a webhook URL in general_settings (default webhook) or per-alert in alert_to_webhook_url
- Disable digest mode for that alert type if no webhook is intended
- Verify env propagation into docker/k8s deployment
Example fix
# before litellm_settings: alerting: ["spend_tracked"] # no webhook anywhere # after # env: SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T000/B000/XXXX litellm_settings: alerting: ["spend_tracked"]
Defensive patterns
Strategy: validation
Validate before calling
import os
def digest_webhook_available(alerting) -> bool:
return bool(
getattr(alerting, "default_webhook_url", None)
or getattr(alerting, "alert_to_webhook_url", None)
or os.getenv("SLACK_WEBHOOK_URL")
) Try / catch
try:
await alerting._send_alert(...)
except ValueError as e:
if "Missing SLACK_WEBHOOK_URL" in str(e):
log.warning("alert skipped: no webhook configured")
else:
raise Prevention
- Configure SLACK_WEBHOOK_URL (or per-alert webhooks) whenever digest alert types are enabled
- Validate alerting env vars in deployment manifests
- Disable digest mode for alert types without webhooks
When it happens
Trigger: Enabling a digest alert type in alert_types (e.g. 'spend_tracked') without configuring any webhook: no alert_to_webhook_url entry, no default SLACK_WEBHOOK_URL in env/config, and SLACK_WEBHOOK_URL unset.
Common situations: Enabling new alert types in litellm.yaml while the webhook is only configured for other types; deploying to a new environment missing the SLACK_WEBHOOK_URL secret.
Related errors
- Missing webhook_url from environment
- PAGERDUTY_API_KEY is not set
- Trying to Customize Email Alerting {CommonProxyErrors.not_p
- AZURE_SENTINEL_DCR_IMMUTABLE_ID is required. Set it as an en
- AZURE_SENTINEL_ENDPOINT is required. Set it as an environmen
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/aecc297b688051bd.
Report an issue: GitHub.