mlflow/mlflow · error · MlflowException
BAD_REQUEST
BAD_REQUEST
Error message
No suitable adapter found for model_uri='{model_uri}'. What it means
get_adapter is the judge adapter factory: it tries DatabricksManagedJudgeAdapter, GatewayAdapter, and LiteLLMAdapter in order, each via is_applicable(model_uri, prompt). If none matches the given model_uri/prompt combination, it raises BAD_REQUEST 'No suitable adapter found'. This means the model_uri isn't recognized as a Databricks judge, a gateway route, or a litellm-supported provider URI.
Source
Thrown at mlflow/genai/judges/adapters/utils.py:63
# Importing mlflow.metrics.genai.model_utils triggers mlflow.metrics.__init__
# → mlflow.metrics.genai → genai_metric → pandas, breaking the skinny client.
from mlflow.genai.judges.adapters.databricks_managed_judge_adapter import (
DatabricksManagedJudgeAdapter,
)
from mlflow.genai.judges.adapters.gateway_adapter import GatewayAdapter
from mlflow.genai.judges.adapters.litellm_adapter import LiteLLMAdapter
adapters = [
DatabricksManagedJudgeAdapter,
GatewayAdapter,
LiteLLMAdapter,
]
for adapter_class in adapters:
if adapter_class.is_applicable(model_uri=model_uri, prompt=prompt):
return adapter_class()
raise MlflowException(
f"No suitable adapter found for model_uri='{model_uri}'.",
error_code=BAD_REQUEST,
)
# ---------------------------------------------------------------------------
# Shared HTTP / error handling
# ---------------------------------------------------------------------------
class ChatCompletionError(Exception):
def __init__(self, status_code: int, message: str, is_context_window_error: bool = False):
self.status_code = status_code
self.message = message
self.is_context_window_error = is_context_window_error
super().__init__(message)
View on GitHub (pinned to 6a27f2decc)
Solutions
- Use a recognized judge model_uri format: 'databricks', a gateway route ('routes:/<name>' style), or a litellm provider URI like 'openai:/gpt-4o'.
- Check for typos in the URI scheme (prefix and ':/' separator).
- If intending a gateway judge, confirm the route exists/registered in the MLflow gateway so GatewayAdapter.is_applicable matches.
- Upgrade/verify MLflow version if using a legacy model URI format that current adapters no longer accept.
Example fix
// before invoke_judge_model(model_uri="gpt-4o", ...) // after invoke_judge_model(model_uri="openai:/gpt-4o", ...)
Defensive patterns
Strategy: validation
Validate before calling
KNOWN_SCHEMES = {"databricks", "endpoints", "routes", "openai", "anthropic", "azure", "bedrock", "vertex_ai", "ollama"}
def validate_judge_model_uri(model_uri: str) -> str:
scheme = model_uri.split(":", 1)[0].lower()
if scheme not in KNOWN_SCHEMES:
raise ValueError(f"Unsupported judge model_uri scheme '{scheme}': use e.g. 'openai:/gpt-4o', 'databricks', or a gateway route")
return model_uri Try / catch
from mlflow.exceptions import MlflowException
try:
feedback = invoke_judge_model(model_uri=uri, ...)
except MlflowException as e:
if "No suitable adapter found" in str(e):
raise ValueError(f"Bad judge model_uri '{uri}'. Use 'openai:/<model>', 'databricks', or a registered gateway route.") from e
raise Prevention
- Always use provider-prefixed URIs ('openai:/gpt-4o') for litellm judges
- Register gateway routes before referencing them
- Centralize judge model URIs in config validated at startup
- Spell-check URI schemes; missing ':' or '/' typos are common
When it happens
Trigger: Passing a model_uri with an unknown or missing scheme (e.g. 'my-model', 'foo:/bar', or a bare deployment name) to judge invocation APIs (invoke_judge_model and higher-level judges), where it matches none of the adapters' is_applicable checks.
Common situations: Typos in URI prefix ('openai//gpt-4', missing ':'); using a local model path or HuggingFace id where a provider-prefixed URI is required; pointing at a gateway route name that isn't registered so GatewayAdapter doesn't apply; older MLflow code paths passing legacy model URIs no longer supported.
Understand the failure class
Background: BAD_REQUEST error code: request rejected as invalid (HTTP 400) - causes and fixes across libraries — this error's family across 8 libraries.
Related errors
- Databricks host not found. Please either: 1. Set the DATAB
- @kubernetes/client-node is not installed. It is required for
- Invalid response format: missing credential_info
- An MLflow Tracking URI is required, please provide the track
- An MLflow experiment ID is required, please provide the expe
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/63f4446b8e59c8d4.
Report an issue: GitHub.