mlflow/mlflow · error · MlflowException
INVALID_PARAMETER_VALUE
INVALID_PARAMETER_VALUE
Error message
Both dataset_name and dataset_digest must be provided if one is provided
What it means
Metric requires dataset_name and dataset_digest to be supplied together: if exactly one of the two is provided, __init__ raises this error. The pairing is required so dataset-linked metrics can be uniquely identified.
Source
Thrown at mlflow/entities/metric.py:25
class Metric(_MlflowObject):
"""
Metric object.
"""
def __init__(
self,
key,
value,
timestamp,
step,
model_id: str | None = None,
dataset_name: str | None = None,
dataset_digest: str | None = None,
run_id: str | None = None,
):
if (dataset_name, dataset_digest).count(None) == 1:
raise MlflowException(
"Both dataset_name and dataset_digest must be provided if one is provided",
INVALID_PARAMETER_VALUE,
)
self._key = key
self._value = value
self._timestamp = timestamp
self._step = step
self._model_id = model_id
self._dataset_name = dataset_name
self._dataset_digest = dataset_digest
self._run_id = run_id
@property
def key(self):
"""String key corresponding to the metric name."""
return self._key
View on GitHub (pinned to 6a27f2decc)
Solutions
- Provide both dataset_name and dataset_digest together in the call
- If the metric is not dataset-linked, omit both arguments entirely
- Update calling code/wrappers so both values are sourced from the same dataset metadata
Example fix
// before
mlflow.log_metric("rmse", 0.2, dataset_name="train_set")
// after
mlflow.log_metric("rmse", 0.2, dataset_name="train_set", dataset_digest="abc123") Defensive patterns
Strategy: validation
Validate before calling
if (dataset_name is None) != (dataset_digest is None):
raise ValueError("dataset_name and dataset_digest must be provided together") Try / catch
try:
mlflow.log_metric("rmse", 0.2, dataset_name=ds_name, dataset_digest=ds_digest)
except MlflowException as e:
logger.error("Metric logging failed: %s", e) Prevention
- Always pass dataset_name and dataset_digest from the same source object
- Omit both when the metric is not dataset-linked
- Add a unit test around logging wrappers that forward these kwargs
When it happens
Trigger: mlflow.log_metric(..., dataset_name="x") without dataset_digest, or vice versa; constructing Metric(key, value, timestamp, step, dataset_name="x") directly; one of the two dropped by a wrapper or defaults layer.
Common situations: Copy-pasted logging code where one argument was deleted; calling log_metric with keyword args supported in a newer MLflow but one forgotten; generating metrics in a loop where only the name is templated.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- INVALID_PARAMETER_VALUE
- INVALID_PARAMETER_VALUE
- INVALID_PARAMETER_VALUE
- INVALID_PARAMETER_VALUE
- INVALID_PARAMETER_VALUE
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/bb2fbbaa2e01e68f.
Report an issue: GitHub.