{"record":{"id":"864997de53b692b0","repo":"mlflow/mlflow","slug":"invalid-parameter-value-864997","errorCode":"INVALID_PARAMETER_VALUE","errorMessage":"The target provided is not a valid uri or 'databricks'","messagePattern":"The target provided is not a valid uri or 'databricks'","errorType":"error_code","errorClass":"MlflowException","httpStatus":400,"severity":"error","filePath":"mlflow/deployments/utils.py","lineNumber":63,"sourceCode":"            in the case of Databricks, the fully qualified url.\n\n    Returns:\n        The complete URL, either directly returned or formed and returned by joining the\n        base URL and the endpoint path.\n\n    \"\"\"\n    return endpoint if _is_valid_uri(endpoint) else append_to_uri_path(base_url, endpoint)\n\n\ndef set_deployments_target(target: str):\n    \"\"\"Sets the target deployment client for MLflow deployments\n\n    Args:\n        target: The full uri of a running MLflow AI Gateway or, if running on\n            Databricks, \"databricks\".\n    \"\"\"\n    if not _is_valid_target(target):\n        raise MlflowException.invalid_parameter_value(\n            \"The target provided is not a valid uri or 'databricks'\"\n        )\n\n    global _deployments_target\n    _deployments_target = target\n\n\ndef get_deployments_target() -> str:\n    \"\"\"\n    Returns the currently set MLflow deployments target iff set.\n    If the deployments target has not been set by using ``set_deployments_target``, an\n    ``MlflowException`` is raised.\n    \"\"\"\n    if _deployments_target is not None:\n        return _deployments_target\n    elif uri := MLFLOW_DEPLOYMENTS_TARGET.get():\n        return uri\n    else:","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/deployments/utils.py#L45-L81","documentation":"set_deployments_target accepts only a valid deployment URI or the literal 'databricks'. _is_valid_target checks this; anything else (invalid URI or wrong literal) is rejected with INVALID_PARAMETER_VALUE.","triggerScenarios":"Calling mlflow.deployments.set_deployments_target(target) with a malformed URI (e.g. missing scheme like 'localhost:5000' without http, or an empty string) or a typo of 'databricks'.","commonSituations":"Typos like 'Databricks' (case-sensitive) or 'databrick'; passing 'localhost:5000' without a scheme; passing None or a config value that is empty.","solutions":["Pass a full URI with scheme, e.g. 'https://ai-gateway.example.com' or 'http://localhost:5000'","Or pass the exact lowercase string 'databricks' when on Databricks","Normalize/validate the target before calling (urlparse: require scheme, or target == 'databricks')"],"exampleFix":"// before\nmlflow.deployments.set_deployments_target(\"localhost:5000\")\n\n// after\nmlflow.deployments.set_deployments_target(\"http://localhost:5000\")","handlingStrategy":"validation","validationCode":"import urllib.parse\ndef check_target(target: str):\n    assert target == \"databricks\" or urllib.parse.urlparse(target).scheme, \\\n        f\"target must be a full uri or 'databricks', got {target!r}\"","typeGuard":"def is_valid_deployments_target(target) -> bool:\n    if not isinstance(target, str):\n        return False\n    return target == \"databricks\" or bool(urllib.parse.urlparse(target).scheme)","tryCatchPattern":"try:\n    mlflow.deployments.set_deployments_target(target)\nexcept MlflowException as e:\n    if e.error_code == \"INVALID_PARAMETER_VALUE\":\n        raise ValueError(f\"Invalid deployments target: {target!r}\") from e\n    raise","preventionTips":["Use the exact lowercase literal 'databricks'","Always include http:// or https:// in gateway URIs","Load target from a validated config rather than free-text input"],"tags":["mlflow","deployment","uri","validation"],"backgroundTag":"invalid-uri-format","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}