Lightning-AI/pytorch-lightning · error · KeyError
'{}' not found in registry. Available names: {}
Error message
'{}' not found in registry. Available names: {} What it means
Barebones mode also disables the progress bar. If enable_progress_bar is truthy along with barebones=True, __init__ raises ValueError and then forces enable_progress_bar=False when valid.
Source
Thrown at src/lightning/fabric/accelerators/registry.py:104
@override
def get(self, name: str, default: Optional[Any] = None) -> Any:
"""Calls the registered accelerator with the required parameters and returns the accelerator object.
Args:
name (str): the name that identifies a accelerator, e.g. "gpu"
"""
if name in self:
data = self[name]
return data["accelerator"](**data["init_params"])
if default is not None:
return default
err_msg = "'{}' not found in registry. Available names: {}"
available_names = self.available_accelerators()
raise KeyError(err_msg.format(name, available_names))
def remove(self, name: str) -> None:
"""Removes the registered accelerator by name."""
self.pop(name)
def available_accelerators(self) -> set[str]:
"""Returns a set of registered accelerators."""
return set(self.keys())
def __str__(self) -> str:
return "Registered Accelerators: {}".format(", ".join(self.available_accelerators()))
def call_register_accelerators(registry: _AcceleratorRegistry, base_module: str) -> None: # pragma: no-cover
"""Legacy.
Do not use.
View on GitHub (pinned to 9fed5c27d2)
Solutions
- Set enable_progress_bar=False (or omit it) with barebones=True
- If you need a progress bar, disable barebones and turn off logger/checkpointing individually
Example fix
# before trainer = Trainer(barebones=True, enable_progress_bar=True) # after trainer = Trainer(barebones=True, enable_progress_bar=False)
Defensive patterns
Strategy: validation
Validate before calling
def check_barebones_pb(barebones: bool, enable_progress_bar: bool) -> None:
if barebones and enable_progress_bar:
raise ValueError("barebones=True requires enable_progress_bar=False") Type guard
def progress_bar_allowed_in_barebones(barebones: bool, pb: bool) -> bool:
return (not barebones) or not pb Prevention
- Explicitly set enable_progress_bar=False in barebones configs
- Use a pre-flight assert over all barebones-incompatible options
- Keep benchmark Trainer construction in one helper so constraints are enforced once
When it happens
Trigger: Trainer(barebones=True, enable_progress_bar=True); any truthy enable_progress_bar value combined with barebones mode.
Common situations: Copy-pasted Trainer kwargs from a normal run into a benchmark run; shared config templates; wanting some visibility during barebones benchmarks, which Lightning forbids.
Related errors
- `name` must be a str, found {name}
- '{name}' is already present in the registry. HINT: Use `over
- f"`Trainer(barebones=True, log_every_n_steps={log_every_n_st
- f"`Trainer(barebones=True, enable_model_summary={enable_mode
- f"`Trainer(barebones=True, num_sanity_val_steps={num_sanity_
AI-assisted analysis of Lightning-AI/pytorch-lightning@9fed5c27d2 (2026-08-28).
Data as JSON: /api/errors/3fec3eda785569d2.
Report an issue: GitHub.