xai-org/x-algorithm · error · ValueError
Config module {mod_name!r} has no key {ver!r}. Available key
Error message
Config module {mod_name!r} has no key {ver!r}. Available keys: {avail} What it means
The config module was found and has CONFIGS, but the requested key (the part after the first '.') is not present. The message lists the available keys to aid correction.
Source
Thrown at phoenix/python/common/xai-configlib/src/xai_configlib/__init__.py:597
mod_name, ver = parts
try:
mod = get_module(f"{base_module_name}.{mod_name}")
except ModuleNotFoundError as e:
if on_failure_log_additional_info:
discovered_configs = get_all_configs_from_module(
base_module_name, ignore_loading_errors=True
)
available_configs = sorted(discovered_configs.configs.keys())
print(f"Available configs: {available_configs}")
raise e
configs = get_configs_from_mod(mod)
if configs is None:
raise ValueError(f"Module {mod_name!r} does not have CONFIGS")
if ver not in configs:
avail = ", ".join(configs.keys())
raise ValueError(f"Config module {mod_name!r} has no key {ver!r}. Available keys: {avail}")
return configs[ver]
class DiscoveredConfigsInModule(NamedTuple):
configs: dict[str, Config]
failing_modules: list[str]
def get_all_configs_from_module(
base_module_name: str,
ignore_loading_errors: bool = False,
) -> DiscoveredConfigsInModule:
mod = get_module(base_module_name)
if not hasattr(mod, "__path__"):
raise ValueError(f"Module '{base_module_name}' is not a package containing configs.")
configs: dict[str, Config] = {}
failing_modules: list[str] = []View on GitHub (pinned to 24c60942c5)
Solutions
- Use one of the keys listed in the error's 'Available keys'
- Add the missing key to the module's CONFIGS dict
- Update the launch script after config renames
Example fix
# before
get_named_config_from_module("my_cfg.v3", "xrex.configs")
# after
get_named_config_from_module("my_cfg.v2", "xrex.configs") Defensive patterns
Strategy: validation
Validate before calling
from xai_configlib import get_configs_from_mod
keys = set(get_configs_from_mod(mod) or {})
assert ver in keys, f"{ver!r} not in {sorted(keys)}" Try / catch
try:
get_named_config_from_module(name, base)
except ValueError as e:
if "has no key" in str(e):
print("Available:", str(e).split("Available keys: ")[-1])
raise Prevention
- Log available keys on startup
- Keep deprecated keys as aliases during transitions
When it happens
Trigger: Requesting 'my_cfg.v3' when CONFIGS only defines 'v1','v2'; also stale key names after a config restructure.
Common situations: Version bumps removing old keys, launch scripts referencing deleted experiment configs, typos in the version suffix.
Related errors
- Invalid argument {arg!r}, not a key=value replacement and no
- Expected bool [True, true, False, false], got {val!r}
- Got {val} for union type {ty}
- Tuple {ty} has different number of arguments from given valu
- Literal {ty} does not allow for {val!r}
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/621d1b31fb0602a5.
Report an issue: GitHub.