{"record":{"id":"3a24350ecf5de56f","repo":"huggingface/open-r1","slug":"callback-callback-name-not-found-in-callbacks","errorCode":null,"errorMessage":"Callback {callback_name} not found in CALLBACKS.","messagePattern":"Callback (.+?) not found in CALLBACKS\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/open_r1/utils/callbacks.py","lineNumber":89,"sourceCode":"                dummy_config.benchmarks = args.benchmarks\n\n                def run_benchmark_callback(_):\n                    print(f\"Checkpoint {global_step} pushed to hub.\")\n                    run_benchmark_jobs(dummy_config, self.model_config)\n\n                future.add_done_callback(run_benchmark_callback)\n\n\nCALLBACKS = {\n    \"push_to_hub_revision\": PushToHubRevisionCallback,\n}\n\n\ndef get_callbacks(train_config, model_config) -> List[TrainerCallback]:\n    callbacks = []\n    for callback_name in train_config.callbacks:\n        if callback_name not in CALLBACKS:\n            raise ValueError(f\"Callback {callback_name} not found in CALLBACKS.\")\n        callbacks.append(CALLBACKS[callback_name](model_config))\n\n    return callbacks\n","sourceCodeStart":71,"sourceCodeEnd":93,"githubUrl":"https://github.com/huggingface/open-r1/blob/1416fa0cf21595d2083b399a2a0bbddd7f6e9563/src/open_r1/utils/callbacks.py#L71-L93","documentation":"get_callbacks resolves each callback name listed in train_config.callbacks against the module-level CALLBACKS registry dict and instantiates it with model_config. An unknown name is not silently skipped — it raises this ValueError so misconfigured callback names fail fast at startup.","triggerScenarios":"train_config.callbacks contains a name (e.g. from a YAML 'callbacks: [my_callback]') that is not a key in CALLBACKS (e.g. not one of the built-ins like 'rich_progress_callback').","commonSituations":"Typo in the callback name in a training YAML; assuming arbitrary custom TrainerCallback classes can be referenced by name without registering them; copying configs between repos with different registries.","solutions":["Correct the name in your config to one present in CALLBACKS (check src/open_r1/utils/callbacks.py).","If it's a custom callback, import it in callbacks.py and register it in the CALLBACKS dict.","Remove the entry from train_config.callbacks if you don't need it."],"exampleFix":"// before\n# config.yaml\ncallbacks: [tensorboard_callback]   # not registered\n// after\ncallbacks: [rich_progress_callback]  # a key that exists in CALLBACKS","handlingStrategy":"validation","validationCode":"from open_r1.utils.callbacks import CALLBACKS\nunknown = [c for c in train_config.callbacks if c not in CALLBACKS]\nif unknown:\n    raise SystemExit(f\"Unknown callbacks {unknown}; available: {sorted(CALLBACKS)}\")","typeGuard":"def callbacks_registered(names, registry) -> bool:\n    return all(isinstance(n, str) and n in registry for n in names)","tryCatchPattern":"try:\n    cbs = get_callbacks(train_config, model_config)\nexcept ValueError as e:\n    if \"not found in CALLBACKS\" in str(e):\n        sys.exit(f\"Fix config callbacks; valid options: {sorted(CALLBACKS)}\")\n    raise","preventionTips":["Keep callback names in YAML limited to registered CALLBACKS keys","Register custom callbacks in CALLBACKS before referencing them in configs","List available callbacks in your config schema/docs to catch typos"],"tags":["python","configuration","callbacks","registry"],"backgroundTag":"unknown-callback-name","analyzedSha":"1416fa0cf21595d2083b399a2a0bbddd7f6e9563","analyzedAt":"2026-08-30T08:56:53.400Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}