BerriAI/litellm · error · Exception

Trying to use Banned KeywordsThis uses the enterprise folder

Error message

Trying to use Banned KeywordsThis uses the enterprise folder - only available on the Docker image.

What it means

The callback 'banned_keywords' imports enterprise.enterprise_hooks.banned_keywords from the 'enterprise' folder. That folder exists only in the LiteLLM enterprise Docker image. On a pip install or source checkout the import fails, and the loader converts the ImportError into this Exception during config load.

Source

Thrown at litellm/proxy/common_utils/callback_utils.py:300

                        _ENTERPRISE_BlockedUserList,
                    )
                except ImportError:
                    raise Exception(
                        "Trying to use Blocked User List" + CommonProxyErrors.missing_enterprise_package_docker.value
                    )

                if premium_user is not True:
                    raise Exception("Trying to use ENTERPRISE BlockedUser" + CommonProxyErrors.not_premium_user.value)

                blocked_user_list = _ENTERPRISE_BlockedUserList(prisma_client=prisma_client)
                imported_list.append(blocked_user_list)
            elif isinstance(callback, str) and callback == "banned_keywords":
                try:
                    from enterprise.enterprise_hooks.banned_keywords import (
                        _ENTERPRISE_BannedKeywords,
                    )
                except ImportError:
                    raise Exception(
                        "Trying to use Banned Keywords" + CommonProxyErrors.missing_enterprise_package_docker.value
                    )

                if premium_user is not True:
                    raise Exception("Trying to use ENTERPRISE BannedKeyword" + CommonProxyErrors.not_premium_user.value)

                banned_keywords_obj = _ENTERPRISE_BannedKeywords()
                imported_list.append(banned_keywords_obj)
            elif isinstance(callback, str) and callback == "detect_prompt_injection":
                from litellm.proxy.hooks.prompt_injection_detection import (
                    _OPTIONAL_PromptInjectionDetection,
                )

                prompt_injection_params = None
                if "prompt_injection_params" in litellm_settings:
                    prompt_injection_params_in_config = litellm_settings["prompt_injection_params"]
                    prompt_injection_params = LiteLLMPromptInjectionParams(**prompt_injection_params_in_config)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Remove 'banned_keywords' from litellm_settings.callbacks.
  2. Or switch the deployment to the LiteLLM enterprise Docker image.
  3. Remember that a valid LITELLM_LICENSE is still required afterwards (error 2886).

Example fix

# before
litellm_settings:
  callbacks: ["banned_keywords"]

# after
litellm_settings:
  callbacks: []
# or: run litellm enterprise docker image + LITELLM_LICENSE
Defensive patterns

Strategy: validation

Validate before calling

import os

def banned_keywords_ok() -> bool:
    return os.path.isdir("enterprise") and os.path.exists("enterprise/enterprise_hooks/banned_keywords.py")

if "banned_keywords" in callbacks and not banned_keywords_ok():
    raise SystemExit("banned_keywords needs the enterprise docker image")

Try / catch

try:
    start_proxy(cfg)
except Exception as e:
    if "Banned Keywords" in str(e) and "Docker" in str(e):
        raise SystemExit("run enterprise image or remove banned_keywords")
    raise

Prevention

When it happens

Trigger: Start the proxy with litellm_settings.callbacks: ['banned_keywords'] outside the enterprise Docker image (pip install litellm, local source run, custom image without the enterprise folder).

Common situations: Trying keyword blocking after reading the enterprise docs, without noticing it is image-gated. Moving a working config from the enterprise image to a bare-metal or pip-based deployment.

Understand the failure class

Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.

Related errors


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