BerriAI/litellm · error · Exception

Trying to use Secret DetectionMissing litellm-enterprise pac

Error message

Trying to use Secret DetectionMissing litellm-enterprise package. Please install it to use this feature. Run `pip install litellm-enterprise`

What it means

Raised at proxy startup when callbacks includes 'hide_secrets' (secret detection/redaction) but importing litellm_enterprise.enterprise_callbacks.secret_detection._ENTERPRISE_SecretDetection raises ImportError. Like Llama Guard, secret hiding is an enterprise feature packaged in the separate litellm-enterprise distribution; the open-source litellm install cannot provide it. The message text runs together ('Trying to use Secret DetectionMissing litellm-enterprise package...') because two strings are concatenated without a separator.

Source

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

                        _ENTERPRISE_LlamaGuard,
                    )
                except ImportError:
                    raise Exception(
                        "MissingTrying to use Llama Guard" + CommonProxyErrors.missing_enterprise_package.value
                    )

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

                llama_guard_object = _ENTERPRISE_LlamaGuard()
                imported_list.append(llama_guard_object)
            elif isinstance(callback, str) and callback == "hide_secrets":
                try:
                    from litellm_enterprise.enterprise_callbacks.secret_detection import (
                        _ENTERPRISE_SecretDetection,
                    )
                except ImportError:
                    raise Exception(
                        "Trying to use Secret Detection" + CommonProxyErrors.missing_enterprise_package.value
                    )

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

                _secret_detection_object = _ENTERPRISE_SecretDetection()
                imported_list.append(_secret_detection_object)
            elif isinstance(callback, str) and callback == "openai_moderations":
                try:
                    from enterprise.enterprise_hooks.openai_moderation import (
                        _ENTERPRISE_OpenAI_Moderation,
                    )
                except ImportError:
                    raise Exception(
                        "Trying to use OpenAI Moderations Check,"
                        + CommonProxyErrors.missing_enterprise_package_docker.value
                    )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. pip install litellm-enterprise in the environment that runs the proxy.
  2. Rebuild the docker image so the new dependency is baked in.
  3. Remove 'hide_secrets' from callbacks if the feature is not licensed/needed.
  4. Confirm the import works: python -c "from litellm_enterprise.enterprise_callbacks.secret_detection import _ENTERPRISE_SecretDetection".

Example fix

# before
# requirements: litellm only, config has callbacks: ["hide_secrets"]

# after
# requirements add:
litellm-enterprise
Defensive patterns

Strategy: fallback

Validate before calling

import importlib.util

if 'hide_secrets' in callbacks and importlib.util.find_spec('litellm_enterprise') is None:
    callbacks.remove('hide_secrets')  # or fail loudly, per your policy
    logger.warning('hide_secrets disabled: litellm-enterprise not installed')

Try / catch

try:
    from litellm_enterprise.enterprise_callbacks.secret_detection import _ENTERPRISE_SecretDetection  # noqa
    HIDE_SECRETS_OK = True
except ImportError:
    HIDE_SECRETS_OK = False

callbacks = ['hide_secrets'] if HIDE_SECRETS_OK else []

Prevention

When it happens

Trigger: Enabling callbacks: ['hide_secrets'] in litellm_settings on an environment where pip show litellm-enterprise fails; CI images built from the plain litellm wheel; deploys where the enterprise package was dropped from requirements.

Common situations: Adopting the secret-masking guardrail after reading enterprise docs; environment drift between prod (enterprise installed) and staging (not); docker images not rebuilt after adding the callback.

Related errors


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