BerriAI/litellm · warning · ValueError

For SAP Masking Module Config you must set exactly one of: '

Error message

For SAP Masking Module Config you must set exactly one of: 'providers' or 'masking_providers', not both.

What it means

MaskingModuleConfig rejects requests that set both 'providers' and the deprecated 'masking_providers' - the validator requires exactly one so it is unambiguous which list applies. Setting both raises this ValueError before any network call.

Source

Thrown at litellm/llms/sap/chat/models.py:381

    Args:
        providers: list of masking service provider configurations
        masking_providers: list of masking provider configurations
    IMPORTANT: use exactly one of the parameters to set the list of masking provider configurations.
    DEPRECATED: parameter 'masking_providers' will be removed Sept 15, 2026. Use 'providers' instead.
    """

    providers: list[MaskingProviderConfig] | None = Field(min_length=1, default=None)
    masking_providers: list[MaskingProviderConfig] | None = Field(min_length=1, default=None)

    @model_validator(mode="after")
    def enforce_exactly_one_provider_list(self):
        has_providers: Final = self.providers is not None
        has_masking_providers: Final = self.masking_providers is not None

        if not has_providers and not has_masking_providers:
            raise ValueError("For SAP Masking Module Config you must provide 'providers'.")
        if has_providers and has_masking_providers:
            raise ValueError(
                "For SAP Masking Module Config you must set exactly one of: 'providers' or 'masking_providers', not both."
            )

        if has_masking_providers:
            warnings.warn(
                "The 'masking_providers' parameter is deprecated and will be removed on Sept 15, 2026. "
                "Use 'providers' instead.",
                DeprecationWarning,
                stacklevel=5,
            )

        return self


class AzureThreshold(int, Enum):
    """
    Enumerates the threshold levels for the Azure Content Safety service.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Delete the deprecated 'masking_providers' key and keep only 'providers'.
  2. Audit config-merge code so renamed fields replace rather than accumulate.
  3. Note the deprecation: masking_providers is removed Sept 15, 2026, so migrate now.

Example fix

# before
{'masking': {'providers': [a], 'masking_providers': [b]}}
# after
{'masking': {'providers': [a]}}
Defensive patterns

Strategy: validation

Validate before calling

def sanitize_masking(masking: dict) -> dict:
    masking = dict(masking)
    masking.pop('masking_providers', None)  # deprecated; never send both
    if 'providers' not in masking:
        masking['providers'] = masking.get('providers')  # missing case validated upstream
    return masking

Prevention

When it happens

Trigger: A request body containing both providers and masking_providers keys under the masking module - typically legacy config partially migrated to the new field name.

Common situations: Migrating from masking_providers to providers and leaving the old key in place; merging a deprecated base config with a new overlay so both keys survive; copying SAP docs examples that show old and new side by side.

Related errors


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