{"record":{"id":"731eeb8d0aeab43d","repo":"mlflow/mlflow","slug":"unexpected-config-type-config-model-config-731eeb","errorCode":null,"errorMessage":"Unexpected config type {config.model.config}","messagePattern":"Unexpected config type (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"mlflow/gateway/providers/litellm.py","lineNumber":95,"sourceCode":"\n    PASSTHROUGH_PROVIDER_PATHS = {\n        PassthroughAction.OPENAI_CHAT: \"chat/completions\",\n        PassthroughAction.OPENAI_EMBEDDINGS: \"embeddings\",\n        PassthroughAction.OPENAI_RESPONSES: \"responses\",\n        PassthroughAction.ANTHROPIC_MESSAGES: \"messages\",\n        PassthroughAction.GEMINI_GENERATE_CONTENT: \"{model}:generateContent\",\n        PassthroughAction.GEMINI_STREAM_GENERATE_CONTENT: \"{model}:streamGenerateContent\",\n    }\n\n    def __init__(self, config: EndpointConfig, enable_tracing: bool = False) -> None:\n        super().__init__(config, enable_tracing=enable_tracing)\n        if importlib.util.find_spec(\"litellm\") is None:\n            raise MlflowException(\n                \"The `litellm` package is required to use the LiteLLM provider but is not \"\n                \"installed. Please install it with: `pip install litellm`\"\n            )\n        if config.model.config is None or not isinstance(config.model.config, LiteLLMConfig):\n            raise TypeError(f\"Unexpected config type {config.model.config}\")\n        self.litellm_config: LiteLLMConfig = config.model.config\n\n    def get_provider_name(self) -> str:\n        \"\"\"\n        Return the actual underlying provider name instead of \"LiteLLM\".\n\n        For example, if litellm_provider is \"anthropic\", returns \"anthropic\"\n        instead of \"LiteLLM\" for more accurate tracing and metrics.\n        \"\"\"\n        if self.litellm_config.litellm_provider:\n            return self.litellm_config.litellm_provider\n        return self.DISPLAY_NAME\n\n    @property\n    def adapter_class(self):\n        return LiteLLMAdapter\n\n    def _build_litellm_kwargs(self, payload: dict[str, Any]) -> dict[str, Any]:","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/gateway/providers/litellm.py#L77-L113","documentation":"Like the HuggingFace provider, LiteLLM requires model.config to be an instance of LiteLLMConfig. If it is None or a different config class, the provider raises TypeError at construction, since it stores the config as self.litellm_config and cannot proceed without it.","triggerScenarios":"Creating a litellm gateway endpoint without the model.config block, or with a config of another provider's type (e.g. OpenAI/HF config attached to a litellm endpoint), or passing a plain dict programmatically.","commonSituations":"Missing litellm_config section in the endpoint YAML; programmatic EndpointConfig built with the wrong CONFIG_TYPE; mixing provider endpoint templates.","solutions":["Add the LiteLLMConfig block under model.config in the endpoint definition (it holds the litellm auth/auth_type fields).","Programmatically, set model.config to a LiteLLMConfig instance.","Verify the provider name matches the config class you are supplying."],"exampleFix":"# before\nmodel:\n  provider: litellm\n  name: gpt-4o\n# after\nmodel:\n  provider: litellm\n  name: gpt-4o\n  config:\n    litellm_config:\n      auth_type: openai","handlingStrategy":"type-guard","validationCode":"from mlflow.gateway.config import LiteLLMConfig\nif not isinstance(config.model.config, LiteLLMConfig):\n    raise TypeError(\"litellm endpoints require a LiteLLMConfig under model.config\")","typeGuard":"def has_valid_litellm_config(config) -> bool:\n    return isinstance(getattr(getattr(config, 'model', None), 'config', None), LiteLLMConfig)","tryCatchPattern":"try:\n    provider = LiteLLMProvider(config)\nexcept TypeError as e:\n    logger.error(\"Bad LiteLLM endpoint config: %s\", e)\n    raise GatewayConfigError(\"model.config must be a LiteLLMConfig\")","preventionTips":["Include the litellm config block in every litellm endpoint YAML","Validate configs against the provider's CONFIG_TYPE before endpoint creation","Avoid sharing endpoint templates across providers without updating model.config"],"tags":["mlflow","gateway","litellm","configuration","typeerror"],"backgroundTag":"invalid-provider-config","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}