BerriAI/litellm · warning · ValueError
Unknown hook: {hook_name}. Available hooks: {list(ENTERPRISE
Error message
Unknown hook: {hook_name}. Available hooks: {list(ENTERPRISE_PROXY_HOOKS.keys())} What it means
Parameter validation for DALL-E 2 image generation: litellm maps general completion-style optional params onto image-generation calls. For each non-default param not already in optional_params, it must appear in the model's supported OpenAI params; otherwise, unless drop_params=True, a ValueError listing the supported set is raised. DALL-E 2 supports only a small set (prompt, n, size, response_format, user), so richer params (quality, style) fail here.
Source
Thrown at enterprise/enterprise_hooks/__init__.py:30
"managed_vector_stores": _PROXY_LiteLLMManagedVectorStores,
}
def get_enterprise_proxy_hook(
hook_name: Union[
Literal[
"managed_files",
"managed_vector_stores",
"max_parallel_requests",
],
str,
],
):
"""
Factory method to get a enterprise hook instance by name
"""
if hook_name not in ENTERPRISE_PROXY_HOOKS:
raise ValueError(
f"Unknown hook: {hook_name}. Available hooks: {list(ENTERPRISE_PROXY_HOOKS.keys())}"
)
return ENTERPRISE_PROXY_HOOKS[hook_name]
View on GitHub (pinned to 6c2dcb801b)
Solutions
- Remove params not in the error's supported list (for dall-e-2: essentially n, size, response_format, user).
- Or set drop_params=True (litellm.drop_params = True or per-request) to silently drop unsupported params.
- Or switch to dall-e-3 / gpt-image-1 if you need quality/style params.
- Key params per model in config rather than passing a shared dict to all models.
Example fix
# before litellm.image_generation(model="dall-e-2", prompt="cat", quality="hd", style="natural") # after litellm.image_generation(model="dall-e-2", prompt="cat", size="1024x1024") # or: litellm.drop_params = True
Defensive patterns
Strategy: validation
Validate before calling
from litellm.constants import IMAGE_GENERATION_DEFAULT_PARAMS
DALLE2_SUPPORTED = {"prompt", "n", "size", "response_format", "user"}
def validate_dalle2_params(params: dict) -> list[str]:
return [k for k in params if k not in DALLE2_SUPPORTED and k != "prompt"] # non-empty => will raise Type guard
def param_set_is_supported(params: dict, supported: set[str]) -> bool:
return set(params).issubset(supported) Try / catch
try:
img = litellm.image_generation(model="dall-e-2", prompt=p, **params)
except ValueError as e:
if "not supported" in str(e):
params = {k: v for k, v in params.items() if k in DALLE2_SUPPORTED}
img = litellm.image_generation(model="dall-e-2", prompt=p, **params)
else:
raise Prevention
- Keep a per-model allowlist of image params and filter kwargs before calling.
- Set litellm.drop_params = True in apps that must accept user-supplied params safely.
- Check get_supported_openai_params(model) programmatically instead of guessing.
When it happens
Trigger: Calling litellm.image_generation(model='dall-e-2', ...) with parameters DALL-E 2 does not support, e.g. quality='hd', style='natural', or any chat-completion param leaked into the call, without drop_params=True.
Common situations: Sharing one image-generation wrapper across dall-e-2, dall-e-3, and gpt-image-1 and passing the union of all params; upgrading from dall-e-3 code to dall-e-2 for cost without trimming params; router configs with default param blocks applied to every model.
Related errors
- Violated guardrail policy
- `banned_keywords_list` can either be a list or filepath. Non
- File not found. banned_keywords_list={banned_keywords_list}
- Unclassified keys in {PRICES_PATH.name}: {', '.join(unclassi
- No Braintrust API token provided. Pass via Authorization hea
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/81028a77ffd6808d.
Report an issue: GitHub.