{"record":{"id":"eb0d6a9a43351fb3","repo":"BerriAI/litellm","slug":"model-parameter-is-required-but-was-none-please-p","errorCode":null,"errorMessage":"model parameter is required but was None. Please provide a valid model name.","messagePattern":"model parameter is required but was None\\. Please provide a valid model name\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"litellm/litellm_core_utils/get_llm_provider_logic.py","lineNumber":149,"sourceCode":"    model: str,\n    custom_llm_provider: str | None = None,\n    api_base: str | None = None,\n    api_key: str | None = None,\n    litellm_params: GenericLiteLLMParams | None = None,\n) -> tuple[str, str, str | None, str | None]:\n    \"\"\"\n    Returns the provider for a given model name - e.g. 'azure/chatgpt-v-2' -> 'azure'\n\n    For router -> Can also give the whole litellm param dict -> this function will extract the relevant details\n\n    Raises Error - if unable to map model to a provider\n\n    Return model, custom_llm_provider, dynamic_api_key, api_base\n    \"\"\"\n    try:\n        # Early validation - model is required\n        if model is None:\n            raise ValueError(\"model parameter is required but was None. Please provide a valid model name.\")\n\n        if litellm.LiteLLMProxyChatConfig._should_use_litellm_proxy_by_default(\n            litellm_params=cast(LiteLLM_Params | None, litellm_params)\n        ):\n            return litellm.LiteLLMProxyChatConfig.litellm_proxy_get_custom_llm_provider_info(\n                model=model, api_base=api_base, api_key=api_key\n            )\n\n        ## IF LITELLM PARAMS GIVEN ##\n        if litellm_params:\n            if custom_llm_provider is None and api_base is None and api_key is None:\n                custom_llm_provider = litellm_params.custom_llm_provider\n                api_base = litellm_params.api_base\n                api_key = litellm_params.api_key\n\n        dynamic_api_key = None\n        # check if llm provider provided\n        # AZURE AI-Studio Logic - Azure AI Studio supports AZURE/Cohere","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/get_llm_provider_logic.py#L131-L167","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nposts = RssClient.parse_rss_to_posts(xml_text)\n\n# after\nroot = ET.fromstring(xml_text)\nif root.find(\"channel\") is None:\n    log.warning(\"unexpected feed shape from blog, skipping posts\")\n    posts = []\nelse:\n    posts = RssClient.parse_rss_to_posts(xml_text)","handlingStrategy":"validation","validationCode":"def require_model(model) -> str:\n    if not isinstance(model, str) or not model.strip():\n        raise ValueError(f\"model must be a non-empty string, got {model!r}\")\n    return model\n\nlitellm.completion(model=require_model(model), messages=msgs)","typeGuard":"from typing import Any\ndef is_valid_model_name(model: Any) -> bool:\n    return isinstance(model, str) and bool(model.strip())","tryCatchPattern":"try:\n    litellm.completion(model=model, messages=msgs)\nexcept ValueError as e:\n    if \"model parameter is required\" in str(e):\n        model = DEFAULT_MODEL  # explicit fallback instead of None\n        litellm.completion(model=model, messages=msgs)\n    else:\n        raise","preventionTips":["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."],"tags":["rss","xml-parsing","content-negotiation","litellm","internal"],"backgroundTag":"malformed-xml","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}