mlflow/mlflow · error · MlflowException
INVALID_PARAMETER_VALUE
INVALID_PARAMETER_VALUE
Error message
Invalid experiment ID '{experiment_id}'. Experiment ID must be a valid integer. What it means
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.
Source
Thrown at mlflow/store/tracking/sqlalchemy_store.py:753
return sql_experiment.to_mlflow_entity(
effective_trace_archival_retention=effective_trace_archival_retention
)
def _get_experiment(self, session, experiment_id, view_type, eager=False):
"""
Args:
eager: If ``True``, eagerly loads the experiments's tags. If ``False``, these tags
are not eagerly loaded and will be loaded if/when their corresponding
object properties are accessed from the resulting ``SqlExperiment`` object.
"""
experiment_id = experiment_id or SqlAlchemyStore.DEFAULT_EXPERIMENT_ID
stages = LifecycleStage.view_type_to_stages(view_type)
query_options = self._get_eager_experiment_query_options() if eager else []
try:
experiment_id_int = int(experiment_id)
except (ValueError, TypeError):
raise MlflowException(
f"Invalid experiment ID '{experiment_id}'. Experiment ID must be a valid integer.",
INVALID_PARAMETER_VALUE,
)
experiment = (
self
._get_query(session, SqlExperiment)
.options(*query_options)
.filter(
SqlExperiment.experiment_id == experiment_id_int,
SqlExperiment.lifecycle_stage.in_(stages),
)
.one_or_none()
)
if experiment is None:
raise MlflowException(
f"No Experiment with id={experiment_id_int} exists", RESOURCE_DOES_NOT_EXISTView on GitHub (pinned to 6a27f2decc)
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
Example fix
// before
exp = mlflow.get_experiment("my-experiment") # name, not an ID
// after
exp = mlflow.get_experiment_by_name("my-experiment")
# or if you have an ID:
exp = mlflow.get_experiment("123") Defensive patterns
Strategy: validation
Validate before calling
def validate_experiment_id(experiment_id):
if experiment_id is None:
raise ValueError("experiment_id is required")
try:
return int(experiment_id)
except (ValueError, TypeError):
raise ValueError(f"experiment_id must be numeric, got {experiment_id!r}")
exp = mlflow.get_experiment(str(validate_experiment_id(raw_id))) Type guard
def is_valid_experiment_id(value) -> bool:
try:
int(value)
return True
except (ValueError, TypeError):
return False Try / catch
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
try:
exp = mlflow.get_experiment(exp_id)
except MlflowException as e:
if e.get_http_status_code() == 400 and e.error_code == INVALID_PARAMETER_VALUE:
exp = mlflow.get_experiment_by_name(exp_id) # maybe a name was passed
else:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- base_model must be a non-empty string (HuggingFace model ID
- Unsupported adapter type: {adapter_type}. Supported types: {
- Template must be a list of dicts with role and content
- The gateway configuration is invalid: {e}
- Tags must be a dictionary, got {type(tags).__name__}.
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/62bdfb5cce8222dc.
Report an issue: GitHub.