{"record":{"id":"488155d47902eee2","repo":"huggingface/open-r1","slug":"column-names-must-be-consistent-across-all-dataset","errorCode":null,"errorMessage":"Column names must be consistent across all dataset configurations in a mixture. Found different column sets: {[list(cols) for cols in columns_sets]}","messagePattern":"Column names must be consistent across all dataset configurations in a mixture\\. Found different column sets: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/open_r1/configs.py","lineNumber":117,"sourceCode":"                            columns=dataset_config.get(\"columns\"),\n                            weight=dataset_config.get(\"weight\", 1.0),\n                        )\n                    )\n            else:\n                raise ValueError(\"'datasets' must be a list of dataset configurations\")\n\n            self.dataset_mixture = DatasetMixtureConfig(\n                datasets=datasets_list,\n                seed=self.dataset_mixture.get(\"seed\", 0),\n                test_split_size=self.dataset_mixture.get(\"test_split_size\", None),\n            )\n\n            # Check that column names are consistent across all dataset configs\n            columns_sets = [set(dataset.columns) for dataset in datasets_list if dataset.columns is not None]\n            if columns_sets:\n                first_columns = columns_sets[0]\n                if not all(columns == first_columns for columns in columns_sets):\n                    raise ValueError(\n                        \"Column names must be consistent across all dataset configurations in a mixture. \"\n                        f\"Found different column sets: {[list(cols) for cols in columns_sets]}\"\n                    )\n\n\n# TODO: add the shared options with a mixin to reduce code duplication\n@dataclass\nclass GRPOConfig(trl.GRPOConfig):\n    \"\"\"\n    args for callbacks, benchmarks etc\n    \"\"\"\n\n    benchmarks: list[str] = field(\n        default_factory=lambda: [],\n        metadata={\"help\": \"The benchmarks to run after training.\"},\n    )\n    callbacks: list[str] = field(\n        default_factory=lambda: [],","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/huggingface/open-r1/blob/1416fa0cf21595d2083b399a2a0bbddd7f6e9563/src/open_r1/configs.py#L99-L135","documentation":"When building a dataset mixture, if individual dataset configs declare a 'columns' subset, all declared column sets must be identical across the mixture. This guarantees the concatenated/mixed dataset has a uniform schema; __post_init__ compares the sets and raises on mismatch.","triggerScenarios":"dataset_mixture where dataset A specifies columns=[\"prompt\",\"completion\"] and dataset B specifies columns=[\"prompt\",\"chosen\"] (or one declares columns and another declares different ones).","commonSituations":"Mixing chat and completion-formatted datasets with hand-picked columns; renaming a column in one dataset config but not the others; copy-paste between mixture entries with stale column lists.","solutions":["Make the 'columns' lists identical (same names) across every dataset entry in the mixture.","Remove the 'columns' key from all entries and instead normalize schemas in a dataset.map preprocessing step before training.","Align upstream datasets so the columns you select exist with the same names in each source."],"exampleFix":"// before\n{\"datasets\": [{\"id\": \"a\", \"columns\": [\"prompt\", \"chosen\"]}, {\"id\": \"b\", \"columns\": [\"prompt\", \"completion\"]}]}\n// after\n{\"datasets\": [{\"id\": \"a\", \"columns\": [\"prompt\", \"completion\"]}, {\"id\": \"b\", \"columns\": [\"prompt\", \"completion\"]}]}","handlingStrategy":"validation","validationCode":"cols = [set(d[\"columns\"]) for d in mixture.get(\"datasets\", []) if d.get(\"columns\")]\nif cols and any(c != cols[0] for c in cols[1:]):\n    raise ValueError(f\"Inconsistent mixture columns: {[sorted(c) for c in cols]}\")","typeGuard":"def columns_consistent(specs) -> bool:\n    sets = [set(d[\"columns\"]) for d in specs if d.get(\"columns\") is not None]\n    return len({frozenset(s) for s in sets}) <= 1","tryCatchPattern":"try:\n    cfg = DatasetConfig(dataset_mixture=mixture)\nexcept ValueError as e:\n    if \"Column names must be consistent\" in str(e):\n        for d in mixture[\"datasets\"]:\n            d.pop(\"columns\", None)  # fall back to full-schema union\n        cfg = DatasetConfig(dataset_mixture=mixture)\n    else:\n        raise","preventionTips":["Keep a single canonical column list shared by all mixture entries","Normalize source datasets with dataset.select_columns([...]) before training","Diff column sets across mixture entries in a preflight script"],"tags":["python","configuration","schema","datasets"],"backgroundTag":"schema-mismatch","analyzedSha":"1416fa0cf21595d2083b399a2a0bbddd7f6e9563","analyzedAt":"2026-08-30T08:56:53.400Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}