Lightning-AI/pytorch-lightning · error · KeyError
'{}' not found in registry. Available names: {}
Error message
'{}' not found in registry. Available names: {} What it means
StrategyRegistry.get raises KeyError when the requested strategy name is not registered (and no default was provided). The message lists the available names to help correct the typo or identify the missing plugin.
Source
Thrown at src/lightning/fabric/strategies/registry.py:101
@override
def get(self, name: str, default: Optional[Any] = None) -> Any:
"""Calls the registered strategy with the required parameters and returns the strategy object.
Args:
name (str): the name that identifies a strategy, e.g. "deepspeed_stage_3"
"""
if name in self:
data = self[name]
return data["strategy"](**data["init_params"])
if default is not None:
return default
err_msg = "'{}' not found in registry. Available names: {}"
available_names = ", ".join(sorted(self.keys())) or "none"
raise KeyError(err_msg.format(name, available_names))
def remove(self, name: str) -> None:
"""Removes the registered strategy by name."""
self.pop(name)
def available_strategies(self) -> list:
"""Returns a list of registered strategies."""
return list(self.keys())
def __str__(self) -> str:
return "Registered Strategies: {}".format(", ".join(self.keys()))
View on GitHub (pinned to 9fed5c27d2)
Solutions
- Pick a name from the listed available names (the error message enumerates them)
- Install the optional dependency that registers the strategy (pip install lightning[xla] / deepspeed)
- Fix typos, e.g. 'deepspeed_stage_3' vs 'zero_stage_3'
- Register the custom strategy yourself before get()
Example fix
# before
strategy = registry.get('deepseed_stage_3')
# after
print(registry.available_strategies())
strategy = registry.get('deepspeed_stage_3') Defensive patterns
Strategy: validation
Validate before calling
available = set(registry.available_strategies())
assert strategy_name in available, f'{strategy_name!r} not in {sorted(available)}' Type guard
def is_registered_strategy(name: str) -> bool:
return name in registry or name in registry.available_strategies() Try / catch
try:
strat = registry.get(name)
except KeyError as e:
raise ValueError(f'unknown strategy {name}; installed: {registry.available_strategies()}') from e Prevention
- Validate strategy names from config files at startup
- Install optional extras (lightning[xla], deepspeed) before using their strategies
When it happens
Trigger: Accessing registry['name']/registry.get('name') with a misspelled or unregistered strategy name — e.g. 'deepseed' instead of 'deepspeed', or an XLA/deepspeed strategy when the required dependency isn't installed so its name was never registered.
Common situations: Typos in strategy names in config files; strategies whose registration is conditional on optional dependencies (torch_xla, deepspeed) being installed; version changes renaming/removing strategies.
Related errors
- `name` must be a str, found {name}
- '{name}' is already present in the registry. HINT: Use `over
- Received multiple values for {', '.join(duplicated_plugin_ke
- Received both `precision={precision_input}` and `plugins={se
- accelerator set through both strategy class and accelerator
AI-assisted analysis of Lightning-AI/pytorch-lightning@9fed5c27d2 (2026-08-28).
Data as JSON: /api/errors/8fe70471d3d2d54c.
Report an issue: GitHub.