BerriAI/litellm · error · MockTestingParamsDisabledError
Mock testing request params are disabled on this proxy: {',
Error message
Mock testing request params are disabled on this proxy: {', '.join(params)}. An admin can enable them by setting `general_settings.dangerously_allow_mock_testing_request_params: true` in config.yaml. This setting cannot be changed from the Admin UI or the API. What it means
Error "Mock testing request params are disabled on this proxy: {', '.join(params)}. An admin can enable them by setting `general_settings.dangerously_allow_mock_testing_request_params: true` in config.yaml. This setting cannot be changed from the Admin UI or the API." thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/route_llm_request.py:211
f"An admin can enable them by setting `general_settings.{MOCK_TESTING_CONFIG_KEY}: true` "
"in config.yaml. This setting cannot be changed from the Admin UI or the API."
)
},
)
def raise_if_mock_testing_params_disallowed(data: Mapping[str, object], *, allowed: bool) -> None:
"""Reject client-supplied mock testing params unless an admin opted in.
Rejecting (rather than silently dropping) keeps a request that asked for a
synthetic failure from returning a normal success, which reads as a passing
fallback test that never ran.
"""
if allowed:
return
present: Final = tuple(name for name in GATED_MOCK_PARAM_NAMES if name in data)
if present:
raise MockTestingParamsDisabledError(params=present)
def mock_testing_params_allowed() -> bool:
"""Read the opt-in from the running proxy's ``general_settings``."""
from litellm.proxy import proxy_server
return proxy_server.general_settings.get(MOCK_TESTING_CONFIG_KEY, False) is True
def get_team_id_from_data(data: dict) -> str | None:
"""
Get the team id from the data's metadata or litellm_metadata params.
"""
if "metadata" in data and data["metadata"] is not None and "user_api_key_team_id" in data["metadata"]:
return data["metadata"].get("user_api_key_team_id")
elif (
"litellm_metadata" in data
and data["litellm_metadata"] is not NoneView on GitHub (pinned to 77b7c6c40c)
Solutions
- Remove mock-testing-only parameters from the request, or have an admin set general_settings.dangerously_allow_mock_testing_request_params: true in config.yaml.
When it happens
Trigger: Thrown at litellm/proxy/route_llm_request.py:211 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/fe5673ed487e1375.
Report an issue: GitHub.