Lightning-AI/pytorch-lightning · error · MisconfigurationException

You added multiple progress bar callbacks to the Trainer, bu

Error message

You added multiple progress bar callbacks to the Trainer, but currently only one progress bar is supported.

What it means

Raised during Trainer initialization when more than one ProgressBar callback is found in the callbacks list. Lightning's progress bar rendering only supports a single active progress bar, so multiple instances (e.g., a TQDMProgressBar and a RichProgressBar together) are rejected.

Source

Thrown at src/lightning/pytorch/trainer/connectors/callback_connector.py:135

        if not enable_model_summary:
            return

        model_summary_cbs = [type(cb) for cb in self.trainer.callbacks if isinstance(cb, ModelSummary)]
        if model_summary_cbs:
            rank_zero_info(
                f"Trainer already configured with model summary callbacks: {model_summary_cbs}."
                " Skipping setting a default `ModelSummary` callback."
            )
            return

        model_summary: ModelSummary
        model_summary = RichModelSummary() if _RICH_AVAILABLE else ModelSummary()
        self.trainer.callbacks.append(model_summary)

    def _configure_progress_bar(self, enable_progress_bar: bool = True) -> None:
        progress_bars = [c for c in self.trainer.callbacks if isinstance(c, ProgressBar)]
        if len(progress_bars) > 1:
            raise MisconfigurationException(
                "You added multiple progress bar callbacks to the Trainer, but currently only one"
                " progress bar is supported."
            )
        if len(progress_bars) == 1:
            # the user specified the progress bar in the callbacks list
            # so the trainer doesn't need to provide a default one
            if enable_progress_bar:
                return

            # otherwise the user specified a progress bar callback but also
            # elected to disable the progress bar with the trainer flag
            progress_bar_callback = progress_bars[0]
            raise MisconfigurationException(
                "Trainer was configured with `enable_progress_bar=False`"
                f" but found `{progress_bar_callback.__class__.__name__}` in callbacks list."
            )

        if enable_progress_bar:

View on GitHub (pinned to 9fed5c27d2)

Solutions

  1. Keep only one ProgressBar subclass in callbacks
  2. Deduplicate before constructing: callbacks=[cb for cb in callbacks if not isinstance(cb, ProgressBar)] + [RichProgressBar()]
  3. Omit progress bar callbacks entirely and customize via enable_progress_bar plus defaults

Example fix

# before
trainer = Trainer(callbacks=[TQDMProgressBar(), RichProgressBar()])
# after
trainer = Trainer(callbacks=[RichProgressBar()])
Defensive patterns

Strategy: validation

Validate before calling

from lightning.pytorch.callbacks.progress import ProgressBar

cbs = [c for c in callbacks if not isinstance(c, ProgressBar)] + [my_progress_bar]
assert sum(isinstance(c, ProgressBar) for c in cbs) <= 1
trainer = Trainer(callbacks=cbs)

Type guard

def has_single_progress_bar(callbacks) -> bool:
    from lightning.pytorch.callbacks import ProgressBar
    return sum(isinstance(c, ProgressBar) for c in callbacks) <= 1

Prevention

When it happens

Trigger: Passing callbacks=[TQDMProgressBar(), RichProgressBar()] or any two subclasses of ProgressBar; commonly from combining callback lists: base_callbacks + [RichProgressBar()] where the base already contains one.

Common situations: Concatenating reusable callback bundles with an extra progress bar; switching from TQDM to Rich and forgetting to remove the old one; test fixtures that append a progress bar to a default list.

Related errors


AI-assisted analysis of Lightning-AI/pytorch-lightning@9fed5c27d2 (2026-08-28). Data as JSON: /api/errors/4abd63e8fc58c18f. Report an issue: GitHub.