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

  1. Remove params not in the error's supported list (for dall-e-2: essentially n, size, response_format, user).
  2. Or set drop_params=True (litellm.drop_params = True or per-request) to silently drop unsupported params.
  3. Or switch to dall-e-3 / gpt-image-1 if you need quality/style params.
  4. 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

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


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/81028a77ffd6808d. Report an issue: GitHub.