{"record":{"id":"b217d6655df96384","repo":"huggingface/open-r1","slug":"dataset-question-field-error-prompt-column-is-n","errorCode":null,"errorMessage":"Dataset Question Field Error: {prompt_column} is not supported.","messagePattern":"Dataset Question Field Error: (.+?) is not supported\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/open_r1/grpo.py","lineNumber":98,"sourceCode":"\n    ##############\n    # Load model #\n    ##############\n    logger.info(\"*** Loading model ***\")\n    model = get_model(model_args, training_args)\n\n    # Get reward functions from the registry\n    reward_funcs = get_reward_funcs(script_args)\n\n    # Format into conversation\n    def make_conversation(example, prompt_column: str = script_args.dataset_prompt_column):\n        prompt = []\n\n        if training_args.system_prompt is not None:\n            prompt.append({\"role\": \"system\", \"content\": training_args.system_prompt})\n\n        if prompt_column not in example:\n            raise ValueError(f\"Dataset Question Field Error: {prompt_column} is not supported.\")\n\n        prompt.append({\"role\": \"user\", \"content\": example[prompt_column]})\n        return {\"prompt\": prompt}\n\n    dataset = dataset.map(make_conversation)\n\n    for split in dataset:\n        if \"messages\" in dataset[split].column_names:\n            dataset[split] = dataset[split].remove_columns(\"messages\")\n\n    #############################\n    # Initialize the GRPO trainer\n    #############################\n    trainer = GRPOTrainer(\n        model=model,\n        reward_funcs=reward_funcs,\n        args=training_args,\n        train_dataset=dataset[script_args.dataset_train_split],","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/huggingface/open-r1/blob/1416fa0cf21595d2083b399a2a0bbddd7f6e9563/src/open_r1/grpo.py#L80-L116","documentation":"make_conversation builds the GRPO 'prompt' column by reading example[prompt_column] (default 'prompt', configurable via dataset_prompt_column). If the mapped dataset lacks that key, it raises this ValueError, since the reward/policy pipeline requires a prompt extracted from a known field.","triggerScenarios":"Calling GRPOTrainer with a dataset whose prompt field is named something other than the configured prompt_column, e.g. a dataset with 'question' or 'problem' but no 'prompt', while training_args.system_prompt / prompt column config still defaults to 'prompt'.","commonSituations":"Swapping in a custom RL dataset (gsm8k, math) whose fields differ from the template's; forgetting to pass dataset_prompt_column; dataset.map over a split that lost the column after filtering/renaming.","solutions":["Rename/prepare your dataset to expose the expected column: dataset = dataset.rename_column(\"question\", \"prompt\").","Or set the matching CLI/config option (e.g. dataset_prompt_column=\"question\") so prompt_column points at your field.","Print dataset.column_names to confirm the actual field names before training."],"exampleFix":"// before\ndataset = load_dataset(\"gsm8k\", \"main\", split=\"train\")  # has 'question', not 'prompt'\n// after\ndataset = load_dataset(\"gsm8k\", \"main\", split=\"train\").rename_column(\"question\", \"prompt\")","handlingStrategy":"validation","validationCode":"required = training_args.dataset_prompt_column or \"prompt\"\nif required not in dataset.column_names:\n    raise SystemExit(f\"Dataset lacks prompt column '{required}'; has {dataset.column_names}\")","typeGuard":"def has_prompt_column(example, col=\"prompt\") -> bool:\n    return isinstance(example, dict) and col in example and isinstance(example[col], str)","tryCatchPattern":"try:\n    dataset = dataset.map(make_conversation)\nexcept ValueError as e:\n    if \"Dataset Question Field Error\" in str(e):\n        sys.exit(\"Set the correct prompt column via the dataset prompt column config or rename the field\")\n    raise","preventionTips":["Print dataset.column_names before mapping","Rename your field to 'prompt' or configure dataset_prompt_column to match","Keep dataset schemas documented alongside training configs"],"tags":["python","datasets","grpo","keyerror"],"backgroundTag":"missing-dataset-column","analyzedSha":"1416fa0cf21595d2083b399a2a0bbddd7f6e9563","analyzedAt":"2026-08-30T08:56:53.400Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}