BerriAI/litellm · error · ValueError

llm_router not available. Cannot access managed files.

Error message

llm_router not available. Cannot access managed files.

What it means

Error "llm_router not available. Cannot access managed files." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/hooks/batch_rate_limiter.py:746

            from litellm.proxy.proxy_server import llm_router, proxy_logging_obj
        except ImportError as e:
            raise ValueError(
                f"Cannot import proxy_server dependencies: {e}. Managed files require proxy_server to be initialized."
            )

        # Get the managed files hook
        if proxy_logging_obj is None:
            raise ValueError("proxy_logging_obj not available. Cannot access managed files hook.")

        managed_files_obj: Final = proxy_logging_obj.get_proxy_hook("managed_files")
        if managed_files_obj is None:
            raise ValueError("Managed files hook not found. Cannot access managed file.")

        if not isinstance(managed_files_obj, BaseFileEndpoints):
            raise ValueError("Managed files hook is not a BaseFileEndpoints instance.")

        if llm_router is None:
            raise ValueError("llm_router not available. Cannot access managed files.")

        # Use the managed files hook to get file content
        # This properly handles user permissions and file ownership
        file_content: Final = await managed_files_obj.afile_content(
            file_id=file_id,
            litellm_parent_otel_span=user_api_key_dict.parent_otel_span,
            llm_router=llm_router,
        )

        return file_content

    async def async_pre_call_hook(
        self,
        user_api_key_dict: UserAPIKeyAuth,
        cache: Any,
        data: dict,
        call_type: str,
    ) -> Exception | str | dict | None:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Configure model_list on the proxy so llm_router is available for managed files.
  2. Verify the proxy started with a valid router configuration.

When it happens

Trigger: Thrown at litellm/proxy/hooks/batch_rate_limiter.py:746 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/67b18b5c1dbcf7f4. Report an issue: GitHub.