BerriAI/litellm · error · Exception
Setting tag based guardrail modes is only available in litel
Error message
Setting tag based guardrail modes is only available in litellm-enterprise. You must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. Pricing: https://www.litellm.ai/#pricing.
What it means
Raised by custom_guardrail.py in LiteLLM Enterprise when tag-based guardrail modes are configured but the running proxy is not a premium (licensed) user. The hook imports premium_user from litellm.proxy.proxy_server; if the enterprise license check failed, any attempt to resolve a Mode-tagged guardrail raises this exception.
Source
Thrown at enterprise/litellm_enterprise/integrations/custom_guardrail.py:30
],
event_type: Optional[GuardrailEventHooks] = None,
) -> Optional[bool]:
"""
Returns True if the guardrail should be run for this request and event_type.
Logic:
- If a request tag matches a Mode tag key, only run if event_type matches
the tag's value (the mode for that tag).
- If no request tag matches, fall back to default mode(s).
"""
from litellm.litellm_core_utils.litellm_logging import (
StandardLoggingPayloadSetup,
)
from litellm.proxy._types import CommonProxyErrors
from litellm.proxy.proxy_server import premium_user
if not premium_user:
raise Exception(
f"Setting tag based guardrail modes is only available in litellm-enterprise. {CommonProxyErrors.not_premium_user.value}."
)
if event_hook is None or not isinstance(event_hook, Mode):
return None
proxy_server_request = data.get("proxy_server_request", {})
request_tags = StandardLoggingPayloadSetup._get_request_tags(
litellm_params=data,
proxy_server_request=proxy_server_request,
)
# Check if any request tag matches a Mode tag key
matched_mode = None
if request_tags:
for tag in request_tags:
if tag in event_hook.tags:View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set LITELLM_LICENSE to a valid enterprise license key in the proxy environment and restart (get a trial key at litellm.ai/enterprise#trial if evaluating)
- If you do not have a license, remove tag-based mode configuration from guardrails and use default_mode only
- Verify premium status at startup: the proxy logs a premium/enterprise banner; check for license validation errors in logs
Example fix
# before
guardrails:
- guardrail_name: bedrock
litellm_params:
guardrail: bedrock
mode: pre_call_check
tag_based_modes:
my_tag: pre_call_check
# no LITELLM_LICENSE set -> error
# after
export LITELLM_LICENSE=<valid-enterprise-key>
# restart proxy Defensive patterns
Strategy: validation
Validate before calling
def has_enterprise(proxy_url: str, key: str) -> bool:
# enterprise features advertise themselves; a cheap proxy is to check config side
return bool(os.environ.get('LITELLM_LICENSE'))
# or catch deterministically on first request in a canary call Try / catch
try:
await litellm.acompletion(**params) # with tag-based guardrail modes
except Exception as e:
if 'not_premium_user' in str(e) or 'litellm-enterprise' in str(e):
raise ConfigError('Set LITELLM_LICENSE or remove tag_based_modes') from e
raise Prevention
- Keep tag-based guardrail mode config in a repo template only enabled when LITELLM_LICENSE is set
- Run a canary request after deploy to fail fast on licensing errors
- Put LITELLM_LICENSE in the same secret store as DATABASE_URL so they deploy together
When it happens
Trigger: Configuring a guardrail with per-tag modes (e.g. litellm_params tag mappings whose value is a guardrail Mode like 'pre_call_check') and sending a request through a proxy without a valid LITELLM_LICENSE. The mode-resolution path executes on every relevant request once tag-based modes are configured.
Common situations: Trialing tag-based guardrails on an OSS install; LITELLM_LICENSE set but expired or invalid so premium_user resolved False; license env var not passed into the Docker container.
Related errors
- You must be a LiteLLM Enterprise user to use this feature. I
- 🚨🚨🚨 DISABLING LLM API ENDPOINTS is an Enterprise feature
- 🚨🚨🚨 DISABLING ADMIN ENDPOINTS is an Enterprise feature 🚨
- Database not connected
- DB not connected. This endpoint needs a database; set DATABA
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/aa4e46b47e1a3c64.
Report an issue: GitHub.