{"record":{"id":"c4ff46e6efbfe1c5","repo":"Lightning-AI/pytorch-lightning","slug":"trainer-was-configured-with-enable-progress-bar-f","errorCode":null,"errorMessage":"Trainer was configured with `enable_progress_bar=False` but found `{progress_bar_callback.__class__.__name__}` in callbacks list.","messagePattern":"Trainer was configured with `enable_progress_bar=False` but found `(.+?)` in callbacks list\\.","errorType":"validation","errorClass":"MisconfigurationException","httpStatus":null,"severity":"error","filePath":"src/lightning/pytorch/trainer/connectors/callback_connector.py","lineNumber":148,"sourceCode":"        self.trainer.callbacks.append(model_summary)\n\n    def _configure_progress_bar(self, enable_progress_bar: bool = True) -> None:\n        progress_bars = [c for c in self.trainer.callbacks if isinstance(c, ProgressBar)]\n        if len(progress_bars) > 1:\n            raise MisconfigurationException(\n                \"You added multiple progress bar callbacks to the Trainer, but currently only one\"\n                \" progress bar is supported.\"\n            )\n        if len(progress_bars) == 1:\n            # the user specified the progress bar in the callbacks list\n            # so the trainer doesn't need to provide a default one\n            if enable_progress_bar:\n                return\n\n            # otherwise the user specified a progress bar callback but also\n            # elected to disable the progress bar with the trainer flag\n            progress_bar_callback = progress_bars[0]\n            raise MisconfigurationException(\n                \"Trainer was configured with `enable_progress_bar=False`\"\n                f\" but found `{progress_bar_callback.__class__.__name__}` in callbacks list.\"\n            )\n\n        if enable_progress_bar:\n            progress_bar_callback = RichProgressBar() if _RICH_AVAILABLE else TQDMProgressBar()\n            self.trainer.callbacks.append(progress_bar_callback)\n\n    def _configure_timer_callback(self, max_time: Optional[Union[str, timedelta, dict[str, int]]] = None) -> None:\n        if max_time is None:\n            return\n        if any(isinstance(cb, Timer) for cb in self.trainer.callbacks):\n            rank_zero_info(\"Ignoring `Trainer(max_time=...)`, callbacks list already contains a Timer.\")\n            return\n        timer = Timer(duration=max_time, interval=\"step\")\n        self.trainer.callbacks.append(timer)\n\n    def _attach_model_logging_functions(self) -> None:","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/trainer/connectors/callback_connector.py#L130-L166","documentation":"Raised during Trainer initialization when enable_progress_bar=False is set but a ProgressBar callback (e.g., TQDMProgressBar or RichProgressBar) is present in callbacks. The explicit flag and the explicit callback contradict each other, so Lightning raises rather than guessing intent.","triggerScenarios":"Trainer(enable_progress_bar=False, callbacks=[TQDMProgressBar()]) or any ProgressBar subclass combined with the disabled flag; typical when silencing output for logs/CI while reusing a callback list that contains a progress bar.","commonSituations":"Running in CI/slurm where output must be suppressed but the shared trainer factory always adds a progress bar; toggling the flag via config without conditioning the callback list.","solutions":["Remove the ProgressBar callback from the list when enable_progress_bar=False","Set enable_progress_bar=True and keep the callback","Conditionally build callbacks: only append the progress bar when the flag is on"],"exampleFix":"# before\ntrainer = Trainer(enable_progress_bar=False, callbacks=[TQDMProgressBar()])\n# after\ncallbacks = [cb for cb in my_callbacks if not isinstance(cb, ProgressBar)]\ntrainer = Trainer(enable_progress_bar=False, callbacks=callbacks)","handlingStrategy":"validation","validationCode":"from lightning.pytorch.callbacks import ProgressBar\n\nif not enable_progress_bar:\n    callbacks = [c for c in callbacks if not isinstance(c, ProgressBar)]\ntrainer = Trainer(enable_progress_bar=enable_progress_bar, callbacks=callbacks)","typeGuard":"def progress_bar_consistent(enable_progress_bar: bool, callbacks) -> bool:\n    from lightning.pytorch.callbacks import ProgressBar\n    has_pb = any(isinstance(c, ProgressBar) for c in callbacks)\n    return not (has_pb and not enable_progress_bar)","tryCatchPattern":null,"preventionTips":["Derive the callback list from the flag in your trainer factory","In CI configs, filter progress bars out instead of just flipping the flag"],"tags":["lightning","progress-bar","trainer-init","config-conflict","callbacks"],"backgroundTag":"conflicting-trainer-options","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}