BerriAI/litellm · error · ValueError
LLM router not initialized
Error message
LLM router not initialized
What it means
_stream_llm_competitor_names needs the proxy's llm_router to dispatch the enrichment LLM call; when the router is None (proxy started without models configured), it raises ValueError, which the endpoint surfaces as a server error. At-fault condition is missing LLM infrastructure, not user input.
Source
Thrown at litellm/proxy/management_endpoints/policy_endpoints/endpoints.py:781
"no numbering, no explanations. If the instruction asks to remove names, "
"return nothing."
)
async def _stream_llm_competitor_names(
prompt: str,
model: str,
existing: list[str],
) -> AsyncIterator[tuple[str | None, bool]]:
"""
Stream competitor names from LLM. Yields (name, is_error) tuples.
Deduplicates against existing names (case-insensitive).
"""
from litellm.proxy.proxy_server import llm_router
if llm_router is None:
raise ValueError("LLM router not initialized")
existing_lower: Final = {n.lower() for n in existing}
response: Final = await llm_router.acompletion(
model=model,
messages=[{"role": "user", "content": prompt}],
temperature=COMPETITOR_LLM_TEMPERATURE,
stream=True,
)
buffer = ""
count = len(existing)
async for chunk in response:
delta = chunk.choices[0].delta.content or ""
buffer += delta
while "\n" in buffer:
line, buffer = buffer.split("\n", 1)
name = _clean_competitor_line(line)
if name and name.lower() not in existing_lower and count < MAX_COMPETITOR_NAMES:
existing_lower.add(name.lower())View on GitHub (pinned to 77b7c6c40c)
Solutions
- Configure models on the proxy so the LLM router initializes.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at litellm/proxy/management_endpoints/policy_endpoints/endpoints.py:781 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/77fa9e2a141590e7.
Report an issue: GitHub.