BerriAI/litellm · error · Exception

Trying to use Google Text Moderation,This uses the enterpris

Error message

Trying to use Google Text Moderation,This uses the enterprise folder - only available on the Docker image.

What it means

Raised at startup when callbacks enables 'google_text_moderation' but importing enterprise.enterprise_hooks.google_text_moderation._ENTERPRISE_GoogleTextModeration fails with ImportError. Like openai_moderations, this hook lives in the 'enterprise' folder that exists only in LiteLLM's official Docker image; a pip-installed proxy cannot load it, and the concatenated message directs you to the Docker image.

Source

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

                    callback_specific_params["lakera_prompt_injection"], dict
                ):
                    init_params = callback_specific_params["lakera_prompt_injection"]
                lakera_moderations_object = lakeraAI_Moderation(**init_params)
                imported_list.append(lakera_moderations_object)
            elif isinstance(callback, str) and callback == "aporia_prompt_injection":
                from litellm.proxy.guardrails.guardrail_hooks.aporia_ai.aporia_ai import (
                    AporiaGuardrail,
                )

                aporia_guardrail_object = AporiaGuardrail()
                imported_list.append(aporia_guardrail_object)
            elif isinstance(callback, str) and callback == "google_text_moderation":
                try:
                    from enterprise.enterprise_hooks.google_text_moderation import (
                        _ENTERPRISE_GoogleTextModeration,
                    )
                except ImportError:
                    raise Exception(
                        "Trying to use Google Text Moderation,"
                        + CommonProxyErrors.missing_enterprise_package_docker.value
                    )

                if premium_user is not True:
                    raise Exception("Trying to use Google Text Moderation" + CommonProxyErrors.not_premium_user.value)

                google_text_moderation_obj = _ENTERPRISE_GoogleTextModeration()
                imported_list.append(google_text_moderation_obj)
            elif isinstance(callback, str) and callback == "llmguard_moderations":
                try:
                    from litellm_enterprise.enterprise_callbacks.llm_guard import (
                        _ENTERPRISE_LLMGuard,
                    )
                except ImportError:
                    raise Exception("Trying to use Llm Guard" + CommonProxyErrors.missing_enterprise_package.value)

                if premium_user is not True:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Deploy with the official litellm/litellm Docker image that includes the enterprise folder.
  2. Or remove 'google_text_moderation' from callbacks for non-docker installs.
  3. Remember the license gate follows: set LITELLM_LICENSE once the import resolves.
  4. Smoke-test custom images: python -c "import enterprise.enterprise_hooks.google_text_moderation".

Example fix

# before
uv pip install litellm && litellm --config config.yaml  # config has callbacks: ["google_text_moderation"]

# after
docker run -e LITELLM_LICENSE=$LITELLM_LICENSE -v $PWD/config.yaml:/app/config.yaml litellm/litellm
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util

if 'google_text_moderation' in callbacks and importlib.util.find_spec('enterprise.enterprise_hooks.google_text_moderation') is None:
    callbacks = [c for c in callbacks if c != 'google_text_moderation']
    logger.warning('google_text_moderation unavailable outside the official Docker image; removed')

Prevention

When it happens

Trigger: callbacks: ['google_text_moderation'] in config.yaml while running litellm from pip, uv, or a custom slim image that does not vendor the enterprise folder. Fails during config load before the server binds.

Common situations: Same config reused across pip dev environments and docker prod; teams building minimal images to cut size and accidentally excluding enterprise hooks; OSS-only installs trialing moderation features.

Related errors


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