{"record":{"id":"7d7c9dbe9aa5c5e4","repo":"mlflow/mlflow","slug":"invalid-parameter-value-7d7c9d","errorCode":"INVALID_PARAMETER_VALUE","errorMessage":"The specified Hugging Face dataset does not contain the specified targets column '{targets}'.","messagePattern":"The specified Hugging Face dataset does not contain the specified targets column '(.+?)'\\.","errorType":"validation","errorClass":"MlflowException","httpStatus":400,"severity":"error","filePath":"mlflow/data/huggingface_dataset.py","lineNumber":51,"sourceCode":"        source: HuggingFaceDatasetSource,\n        targets: str | None = None,\n        name: str | None = None,\n        digest: str | None = None,\n    ):\n        \"\"\"\n        Args:\n            ds: A Hugging Face dataset. Must be an instance of `datasets.Dataset`.\n                Other types, such as :py:class:`datasets.DatasetDict`, are not supported.\n            source: The source of the Hugging Face dataset.\n            targets: The optional name of the Hugging Face dataset column containing targets\n                (labels) for supervised learning.\n            name: The name of the dataset. E.g. \"wiki_train\". If unspecified, a name is\n                automatically generated.\n            digest: The digest (hash, fingerprint) of the dataset. If unspecified, a digest\n                is automatically computed.\n        \"\"\"\n        if targets is not None and targets not in ds.column_names:\n            raise MlflowException(\n                f\"The specified Hugging Face dataset does not contain the specified targets column\"\n                f\" '{targets}'.\",\n                INVALID_PARAMETER_VALUE,\n            )\n\n        self._ds = ds\n        self._targets = targets\n        super().__init__(source=source, name=name, digest=digest)\n\n    def _compute_digest(self) -> str:\n        \"\"\"\n        Computes a digest for the dataset. Called if the user doesn't supply\n        a digest when constructing the dataset.\n        \"\"\"\n        df = next(\n            self._ds.to_pandas(\n                batch_size=_MAX_ROWS_FOR_DIGEST_COMPUTATION_AND_SCHEMA_INFERENCE, batched=True\n            )","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/data/huggingface_dataset.py#L33-L69","documentation":"HuggingFaceDataset construction raises INVALID_PARAMETER_VALUE when a `targets` column name is given that does not exist in the datasets.Dataset's column_names. MLflow validates target presence at construction time so evaluation can group inputs/outputs later.","triggerScenarios":"Calling mlflow.data.from_huggingface(ds, targets=\"label\") where ds.column_names does not contain \"label\" (typo, wrong split, dataset without labels).","commonSituations":"Typo in the targets column name; loading a test split that lacks the label column present in train; datasets where the label column is named differently (e.g. \"labels\", \"target\", \"answer\").","solutions":["Set targets to one of ds.column_names (print them to verify).","Load the split that contains the targets column.","Pass targets=None if the dataset is inputs-only."],"exampleFix":"// before\nds = load_dataset(\"imdb\", split=\"test[0:100]\")\nds_meta = mlflow.data.from_huggingface(ds, targets=\"target\")\n// after\nds_meta = mlflow.data.from_huggingface(ds, targets=\"label\")  # ds.column_names includes 'label'","handlingStrategy":"validation","validationCode":"if targets is not None and targets not in ds.column_names:\n    raise ValueError(\n        f\"targets column {targets!r} not in dataset columns {ds.column_names}\"\n    )","typeGuard":"def has_column(ds, col: str) -> bool:\n    return col is None or col in ds.column_names","tryCatchPattern":"from mlflow.exceptions import MlflowException\ntry:\n    meta = mlflow.data.from_huggingface(ds, targets=targets)\nexcept MlflowException as e:\n    if \"does not contain the specified targets column\" in str(e):\n        meta = mlflow.data.from_huggingface(ds, targets=None)\n    else:\n        raise","preventionTips":["Print ds.column_names before choosing targets","Load the split that actually contains the label column","Watch for label vs labels naming differences","Pass targets=None for inputs-only datasets"],"tags":["mlflow","huggingface","evaluation-dataset","invalid-parameter"],"backgroundTag":"column-not-found","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}