{"record":{"id":"19985433725179a6","repo":"mlflow/mlflow","slug":"resource-does-not-exist-199854","errorCode":"RESOURCE_DOES_NOT_EXIST","errorMessage":"Model definitions not found: {', '.join(missing)}","messagePattern":"Model definitions not found: (.+?)","errorType":"error_code","errorClass":"MlflowException","httpStatus":404,"severity":"error","filePath":"mlflow/store/tracking/gateway/sqlalchemy_mixin.py","lineNumber":667,"sourceCode":"        if not model_configs:\n            raise MlflowException(\n                \"Endpoint must have at least one model configuration\",\n                error_code=INVALID_PARAMETER_VALUE,\n            )\n\n        with self.ManagedSessionMaker(read_only=False) as session:\n            # Validate all model definitions exist\n            all_model_def_ids = {config.model_definition_id for config in model_configs}\n\n            existing_model_defs = (\n                self\n                ._get_query(session, SqlGatewayModelDefinition)\n                .filter(SqlGatewayModelDefinition.model_definition_id.in_(all_model_def_ids))\n                .all()\n            )\n            existing_ids = {m.model_definition_id for m in existing_model_defs}\n            if missing := all_model_def_ids - existing_ids:\n                raise MlflowException(\n                    f\"Model definitions not found: {', '.join(missing)}\",\n                    error_code=RESOURCE_DOES_NOT_EXIST,\n                )\n\n            endpoint_id = f\"e-{uuid.uuid4().hex}\"\n            current_time = get_current_time_millis()\n\n            # Auto-create experiment if usage_tracking is enabled and no experiment_id provided\n            if usage_tracking and experiment_id is None:\n                experiment_id = self._get_or_create_experiment_id(\n                    f\"gateway/{name}\",\n                    tags=[\n                        ExperimentTag(MLFLOW_EXPERIMENT_SOURCE_TYPE, \"GATEWAY\"),\n                        ExperimentTag(MLFLOW_EXPERIMENT_SOURCE_ID, endpoint_id),\n                        ExperimentTag(MLFLOW_EXPERIMENT_IS_GATEWAY, \"true\"),\n                    ],\n                )\n","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/store/tracking/gateway/sqlalchemy_mixin.py#L649-L685","documentation":"Every model configuration supplied to create_gateway_endpoint must reference an existing gateway model definition. MLflow looks up all referenced IDs in one query and raises RESOURCE_DOES_NOT_EXIST listing the IDs that were not found. The endpoint is not created.","triggerScenarios":"Calling create_gateway_endpoint with a model_configs entry whose model_definition_id does not exist (deleted, wrong environment/database, or a typo).","commonSituations":"Reusing IDs exported from another MLflow backend or workspace; a definition deleted after configs were generated; hardcoded IDs in IaC templates; case/whitespace mistakes in IDs.","solutions":["Correct the model_definition_id values, verifying each against search_gateway_model_definitions.","Create the missing model definitions before creating the endpoint.","Regenerate endpoint configs from the current backend rather than reusing stale IDs.","Catch RESOURCE_DOES_NOT_EXIST and parse the message to identify which IDs are missing."],"exampleFix":"// before\nclient.create_gateway_endpoint(name=\"chat\", model_configs=[{\"model_definition_id\": \"d-deleted\"}])\n// after\nknown = {d.model_definition_id for d in client.search_gateway_model_definitions()}\nassert all(c[\"model_definition_id\"] in known for c in model_configs), \"unknown model_definition_id\"\nclient.create_gateway_endpoint(name=\"chat\", model_configs=model_configs)","handlingStrategy":"validation","validationCode":"known = {d.model_definition_id for d in client.search_gateway_model_definitions()}\nmissing = [c[\"model_definition_id\"] for c in model_configs if c[\"model_definition_id\"] not in known]\nif missing:\n    raise ValueError(f\"unknown model_definition_ids: {missing}\")","typeGuard":"null","tryCatchPattern":"try:\n    client.create_gateway_endpoint(...)\nexcept MlflowException as e:\n    if e.error_code == \"RESOURCE_DOES_NOT_EXIST\":\n        raise RuntimeError(f\"Create missing definitions first: {e}\") from e\n    raise","preventionTips":["Resolve definition IDs from the live backend instead of hardcoding them","Create model definitions before endpoints in setup order","Avoid mixing IDs across environments/backends; re-export configs per environment"],"tags":["mlflow","gateway","endpoint","model-definition","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}