{"record":{"id":"62bdfb5cce8222dc","repo":"mlflow/mlflow","slug":"invalid-parameter-value-62bdfb","errorCode":"INVALID_PARAMETER_VALUE","errorMessage":"Invalid experiment ID '{experiment_id}'. Experiment ID must be a valid integer.","messagePattern":"Invalid experiment ID '(.+?)'\\. Experiment ID must be a valid integer\\.","errorType":"error_code","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/store/tracking/sqlalchemy_store.py","lineNumber":753,"sourceCode":"        return sql_experiment.to_mlflow_entity(\n            effective_trace_archival_retention=effective_trace_archival_retention\n        )\n\n    def _get_experiment(self, session, experiment_id, view_type, eager=False):\n        \"\"\"\n        Args:\n            eager: If ``True``, eagerly loads the experiments's tags. If ``False``, these tags\n                are not eagerly loaded and will be loaded if/when their corresponding\n                object properties are accessed from the resulting ``SqlExperiment`` object.\n        \"\"\"\n        experiment_id = experiment_id or SqlAlchemyStore.DEFAULT_EXPERIMENT_ID\n        stages = LifecycleStage.view_type_to_stages(view_type)\n        query_options = self._get_eager_experiment_query_options() if eager else []\n\n        try:\n            experiment_id_int = int(experiment_id)\n        except (ValueError, TypeError):\n            raise MlflowException(\n                f\"Invalid experiment ID '{experiment_id}'. Experiment ID must be a valid integer.\",\n                INVALID_PARAMETER_VALUE,\n            )\n\n        experiment = (\n            self\n            ._get_query(session, SqlExperiment)\n            .options(*query_options)\n            .filter(\n                SqlExperiment.experiment_id == experiment_id_int,\n                SqlExperiment.lifecycle_stage.in_(stages),\n            )\n            .one_or_none()\n        )\n\n        if experiment is None:\n            raise MlflowException(\n                f\"No Experiment with id={experiment_id_int} exists\", RESOURCE_DOES_NOT_EXIST","sourceCodeStart":735,"sourceCodeEnd":771,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/store/tracking/sqlalchemy_store.py#L735-L771","documentation":"MLflow's SQLAlchemy tracking store requires experiment IDs to be integers. `_get_experiment` attempts `int(experiment_id)` and raises this INVALID_PARAMETER_VALUE error when the value is a non-numeric string, None, or otherwise unconvertible. It means the caller passed a malformed experiment identifier, not that the experiment is missing.","triggerScenarios":"Calling get_experiment, delete_experiment, restore_experiment, rename_experiment, or set_experiment_tag with an experiment_id like 'abc', '', 'None', a float string, or None instead of a numeric ID string/int.","commonSituations":"Parsing experiment IDs from URLs, config files, or CLI args where the value was never validated; accidentally passing an experiment *name* where an ID is expected; storing IDs as strings and passing empty/garbage values after a failed lookup; passing a Run or Model object instead of its experiment_id field.","solutions":["Inspect the value passed as experiment_id and print/repr it right before the call to see what is actually being passed","If you have an experiment name, resolve it to an ID first with mlflow.get_experiment_by_name(name).experiment_id","Validate the ID is numeric before calling: str(id).isdigit() or a try/int() cast","Check upstream code for accidentally passing a name, path, run ID, or None instead of the experiment ID","When reading IDs from env/config/CLI, strip whitespace and fail fast with a clear message if not numeric"],"exampleFix":"// before\nexp = mlflow.get_experiment(\"my-experiment\")  # name, not an ID\n\n// after\nexp = mlflow.get_experiment_by_name(\"my-experiment\")\n# or if you have an ID:\nexp = mlflow.get_experiment(\"123\")","handlingStrategy":"validation","validationCode":"def validate_experiment_id(experiment_id):\n    if experiment_id is None:\n        raise ValueError(\"experiment_id is required\")\n    try:\n        return int(experiment_id)\n    except (ValueError, TypeError):\n        raise ValueError(f\"experiment_id must be numeric, got {experiment_id!r}\")\n\nexp = mlflow.get_experiment(str(validate_experiment_id(raw_id)))","typeGuard":"def is_valid_experiment_id(value) -> bool:\n    try:\n        int(value)\n        return True\n    except (ValueError, TypeError):\n        return False","tryCatchPattern":"from mlflow.exceptions import MlflowException\nfrom mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE\ntry:\n    exp = mlflow.get_experiment(exp_id)\nexcept MlflowException as e:\n    if e.get_http_status_code() == 400 and e.error_code == INVALID_PARAMETER_VALUE:\n        exp = mlflow.get_experiment_by_name(exp_id)  # maybe a name was passed\n    else:\n        raise","preventionTips":["Always obtain experiment IDs from mlflow APIs (get_experiment_by_name, search_experiments) rather than free-form strings","Validate numeric-ness at configuration-load time, not at API-call time","Never pass experiment names to ID-parameter APIs","Strip whitespace when reading IDs from env vars or CLI args"],"tags":["python","mlflow","validation","experiment-id"],"backgroundTag":"invalid-integer-id","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}