BerriAI/litellm · error · HTTPException

target_model_names is required when require_managed_files is

Error message

target_model_names is required when require_managed_files is enabled in litellm_settings. Provide one or more model aliases via the target_model_names form field (e.g. target_model_names=my-model-alias).

What it means

Error "target_model_names is required when require_managed_files is enabled in litellm_settings. Provide one or more model aliases via the target_model_names form field (e.g. target_model_names=my-model-alias)." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/openai_files_endpoints/common_utils.py:904

    model: str | None = None,
) -> None:
    """
    Enforce proxy-level managed files when litellm.require_managed_files is enabled.

    Raises:
        HTTPException: 400 if the upload would bypass the managed-files flow, i.e.
            target_model_names is missing or a model parameter routes the request
            through the direct provider path instead of the managed-files hook.
    """
    from fastapi import HTTPException

    import litellm

    if litellm.require_managed_files is not True:
        return

    if not target_model_names:
        raise HTTPException(
            status_code=400,
            detail=(
                "target_model_names is required when require_managed_files is enabled "
                "in litellm_settings. Provide one or more model aliases via the "
                "target_model_names form field (e.g. target_model_names=my-model-alias)."
            ),
        )

    if model:
        raise HTTPException(
            status_code=400,
            detail=(
                "model is not allowed when require_managed_files is enabled in "
                "litellm_settings. Uploads must go through managed files using "
                "target_model_names instead of the model parameter."
            ),
        )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide one or more model aliases via the target_model_names form field (e.g. target_model_names=my-model-alias).

When it happens

Trigger: Thrown at litellm/proxy/openai_files_endpoints/common_utils.py:904 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/91dca5c7162d4696. Report an issue: GitHub.