mlflow/mlflow · error · ValueError

digest is required

Error message

digest is required

What it means

from_dict() requires 'digest' as the third mandatory key; when dataset_id and name are present but digest is missing it raises ValueError('digest is required'). The digest is the content fingerprint MLflow uses for dataset identity and deduplication, so it cannot be reconstructed client-side from a partial dict.

Source

Thrown at mlflow/entities/evaluation_dataset.py:609

            "last_updated_by": self.last_updated_by,
            "experiment_ids": self.experiment_ids,
        })
        if self.version is not None:
            result["version"] = self.version

        result["records"] = [record.to_dict() for record in self.records]

        return result

    @classmethod
    def from_dict(cls, data: dict[str, Any]) -> "EvaluationDataset":
        """Create instance from dictionary representation."""
        if "dataset_id" not in data:
            raise ValueError("dataset_id is required")
        if "name" not in data:
            raise ValueError("name is required")
        if "digest" not in data:
            raise ValueError("digest is required")
        if "created_time" not in data:
            raise ValueError("created_time is required")
        if "last_update_time" not in data:
            raise ValueError("last_update_time is required")

        dataset = cls(
            dataset_id=data["dataset_id"],
            name=data["name"],
            digest=data["digest"],
            created_time=data["created_time"],
            last_update_time=data["last_update_time"],
            tags=data.get("tags"),
            schema=data.get("schema"),
            profile=data.get("profile"),
            created_by=data.get("created_by"),
            last_updated_by=data.get("last_updated_by"),
            version=data.get("version"),
        )

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Include 'digest' in the dict; if unknown, fetch the dataset from the tracking store (search_datasets) and use its to_dict().
  2. Round-trip from a real EvaluationDataset.to_dict() output.
  3. Pre-validate the five required keys before calling from_dict().

Example fix

// before
data = {"dataset_id": "d-123", "name": "eval", "created_time": 1, "last_update_time": 1}

// after
data = {"dataset_id": "d-123", "name": "eval", "digest": "9f2c...", "created_time": 1, "last_update_time": 1}
Defensive patterns

Strategy: validation

Validate before calling

REQUIRED = ("dataset_id", "name", "digest", "created_time", "last_update_time")
missing = [k for k in REQUIRED if k not in data]
if missing:
    raise ValueError(f"cannot hydrate dataset, missing: {missing}")

Type guard

def is_complete_dataset_dict(data: dict) -> bool:
    return all(isinstance(data.get(k), (str, int)) and data.get(k) is not None
               for k in ("dataset_id", "name", "digest", "created_time", "last_update_time"))

Try / catch

try:
    ds = EvaluationDataset.from_dict(data)
except ValueError as e:
    if "digest is required" in str(e):
        from mlflow.tracking import MlflowClient
        remote = next(d for d in MlflowClient().search_datasets() if d.dataset_id == data["dataset_id"])
        ds = EvaluationDataset.from_dict(remote.to_dict())
    else:
        raise

Prevention

When it happens

Trigger: Calling EvaluationDataset.from_dict() with {'dataset_id': ..., 'name': ...} but no 'digest', typically dicts assembled by hand or produced by another tool's export format.

Common situations: Third-party export JSON lacking MLflow's digest field; manually editing a to_dict() output and deleting fields believed optional; caching serialized datasets without the digest.

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


AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29). Data as JSON: /api/errors/6c2fbbe2330f02cb. Report an issue: GitHub.