Lightning-AI/pytorch-lightning · error · MisconfigurationException

'{name}' is already present in the registry. HINT: Use `over

Error message

'{name}' is already present in the registry. HINT: Use `override=True`.

What it means

In barebones mode the Trainer disables logging for maximum speed. Passing any logger that is not None and not False (i.e. a Logger instance, True, or a list of loggers) together with barebones=True raises ValueError; otherwise logger is forced to False.

Source

Thrown at src/lightning/fabric/accelerators/registry.py:69

        description: str = "",
        override: bool = False,
        **init_params: Any,
    ) -> Callable:
        """Registers a accelerator mapped to a name and with required metadata.

        Args:
            name : the name that identifies a accelerator, e.g. "gpu"
            accelerator : accelerator class
            description : accelerator description
            override : overrides the registered accelerator, if True
            init_params: parameters to initialize the accelerator

        """
        if not (name is None or isinstance(name, str)):
            raise TypeError(f"`name` must be a str, found {name}")

        if name in self and not override:
            raise MisconfigurationException(f"'{name}' is already present in the registry. HINT: Use `override=True`.")

        data: dict[str, Any] = {}

        data["description"] = description
        data["init_params"] = init_params

        def do_register(accelerator: Callable) -> Callable:
            data["accelerator"] = accelerator
            data["accelerator_name"] = name
            self[name] = data
            return accelerator

        if accelerator is not None:
            return do_register(accelerator)

        return do_register

    @override

View on GitHub (pinned to 9fed5c27d2)

Solutions

  1. Set logger=False (or omit it, default is None behavior may still be replaced) when using barebones=True
  2. If logging is required, don't use barebones mode; instead disable checkpointing/progress bar individually

Example fix

# before
from lightning.pytorch.loggers import TensorBoardLogger
trainer = Trainer(barebones=True, logger=TensorBoardLogger("logs"))

# after
trainer = Trainer(barebones=True, logger=False)
# or keep logging
trainer = Trainer(logger=TensorBoardLogger("logs"))
Defensive patterns

Strategy: validation

Validate before calling

def check_barebones(barebones: bool, logger) -> None:
    if barebones and logger is not None and logger is not False:
        raise ValueError("barebones=True requires logger=False or None")

Type guard

def logger_allowed_in_barebones(barebones: bool, logger) -> bool:
    return (not barebones) or logger is None or logger is False

Prevention

When it happens

Trigger: Trainer(barebones=True, logger=TensorBoardLogger('logs')); Trainer(barebones=True, logger=True); passing a list of loggers with barebones=True.

Common situations: Benchmark configs that keep the logger from the training config; reusing a shared kwargs dict; wanting to compare barebones speed but forgetting Lightning forbids loggers there.

Related errors


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