BerriAI/litellm · warning · ValueError
model parameter is required but was None. Please provide a…
Error message
model parameter is required but was None. Please provide a valid model name.
What it means
parse_rss_to_posts() in litellm_core_utils/get_blog_posts.py uses ElementTree to parse fetched RSS XML and expects a <channel> child under the root. If root.find('channel') returns None it raises ValueError('RSS feed missing <channel> element') — the fetched document was XML but not a well-formed RSS 2.0 feed (which requires exactly one channel element).
Solutions
- Fetch the same URL from the affected environment and inspect what document actually comes back (curl with the same headers).
- If a proxy/CDN blocks it, allowlist the blog/feed hostname or disable the blog-post fetching feature that calls this.
- Handle both feed shapes: for Atom, look for the Atom namespace or <feed> root instead of <channel>.
- Wrap calls in try/except and degrade gracefully — blog posts are non-essential data.
Example fix
# before
posts = RssClient.parse_rss_to_posts(xml_text)
# after
root = ET.fromstring(xml_text)
if root.find("channel") is None:
log.warning("unexpected feed shape from blog, skipping posts")
posts = []
else:
posts = RssClient.parse_rss_to_posts(xml_text) Defensive patterns
Strategy: validation
Validate before calling
def require_model(model) -> str:
if not isinstance(model, str) or not model.strip():
raise ValueError(f"model must be a non-empty string, got {model!r}")
return model
litellm.completion(model=require_model(model), messages=msgs) Type guard
from typing import Any
def is_valid_model_name(model: Any) -> bool:
return isinstance(model, str) and bool(model.strip()) Try / catch
try:
litellm.completion(model=model, messages=msgs)
except ValueError as e:
if "model parameter is required" in str(e):
model = DEFAULT_MODEL # explicit fallback instead of None
litellm.completion(model=model, messages=msgs)
else:
raise Prevention
- Validate model strings at config load (fail fast), not inside request handlers.
- Use os.environ[...] not os.getenv(...) for required model config so it fails at startup.
- For Router/proxy model_list, assert every entry has litellm_params.model set.
When it happens
Trigger: The litellm blog feed URL returning something other than RSS: an HTML error/interstitial page (CAPTCHA, 403 page, CDN block) that happens to parse as XML, an Atom feed (no <channel>), a truncated body, or a redesign changing the feed structure.
Common situations: Corporate proxies replacing the feed with a block page; the upstream site temporarily serving an error page with 200; environment returning XML error envelopes; changes on the litellm site's feed layout.
Related errors
- skip_pre_call_logic=True requires litellm_logging_obj to be…
- 400
- 404
- Access denied to MCP server
- Admin-only endpoint. Your user role=
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/eb0d6a9a43351fb3.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/litellm_core_utils/get_llm_provider_logic.py:149
model: str,
custom_llm_provider: str | None = None,
api_base: str | None = None,
api_key: str | None = None,
litellm_params: GenericLiteLLMParams | None = None,
) -> tuple[str, str, str | None, str | None]:
"""
Returns the provider for a given model name - e.g. 'azure/chatgpt-v-2' -> 'azure'
For router -> Can also give the whole litellm param dict -> this function will extract the relevant details
Raises Error - if unable to map model to a provider
Return model, custom_llm_provider, dynamic_api_key, api_base
"""
try:
# Early validation - model is required
if model is None:
raise ValueError("model parameter is required but was None. Please provide a valid model name.")
if litellm.LiteLLMProxyChatConfig._should_use_litellm_proxy_by_default(
litellm_params=cast(LiteLLM_Params | None, litellm_params)
):
return litellm.LiteLLMProxyChatConfig.litellm_proxy_get_custom_llm_provider_info(
model=model, api_base=api_base, api_key=api_key
)
## IF LITELLM PARAMS GIVEN ##
if litellm_params:
if custom_llm_provider is None and api_base is None and api_key is None:
custom_llm_provider = litellm_params.custom_llm_provider
api_base = litellm_params.api_base
api_key = litellm_params.api_key
dynamic_api_key = None
# check if llm provider provided
# AZURE AI-Studio Logic - Azure AI Studio supports AZURE/CohereView on GitHub (pinned to 77b7c6c40c)