xai-org/x-algorithm · error · ValueError
Invalid config {name!r}, expected format 'module.key' where
Error message
Invalid config {name!r}, expected format 'module.key' where key cannot contain '.' What it means
xrex's get_named_config splits a name into module and key on ':' (preferred) or the last '.'. Without a colon, a name with no '.' at all cannot yield both parts and raises this ValueError.
Source
Thrown at phoenix/xrex/configs/config_loader.py:83
_DEFAULT_AOT_CACHE_DIR = "/tmp/jax_aot_cache/"
def _apply_deployment_defaults(config: Config) -> Config:
if settings.AOT_CACHE_DIR and getattr(config, "aot_cache_dir", None) == (
_DEFAULT_AOT_CACHE_DIR
):
config.aot_cache_dir = settings.AOT_CACHE_DIR
return config
def get_named_config(name: str) -> Config:
if ":" in name:
mod_name, ver = name.rsplit(":", 1)
else:
parts = name.rsplit(".", 1)
if len(parts) < 2:
raise ValueError(
f"Invalid config {name!r}, expected format 'module.key' where key cannot contain '.'"
)
mod_name, ver = parts
try:
mod = importlib.import_module(mod_name)
except ModuleNotFoundError:
depth = mod_name.count(".")
if depth > 1:
raise ValueError(f"No absolute config module found {mod_name!r}")
try:
mod = importlib.import_module(f"xrex.configs.{mod_name}")
except ModuleNotFoundError:
raise ValueError(
f"No config module {mod_name!r} found, either at the top level or under 'xrex.configs'"
)
View on GitHub (pinned to 24c60942c5)
Solutions
- Use 'module:key' (or 'module.key' when the key has no dots)
- If the key contains dots, use the colon form
Example fix
# before
cfg = get_named_config("myconfig")
# after
cfg = get_named_config("myconfig:v1") Defensive patterns
Strategy: validation
Validate before calling
assert (":" in name) or (name.count(".") >= 1), f"Use 'module:key': {name!r}" Type guard
def is_named_config(name: str) -> bool:
return isinstance(name, str) and (":" in name or "." in name) Prevention
- Prefer the colon separator; centralize name construction
When it happens
Trigger: Calling get_named_config('myconfig') instead of 'myconfig:v1' or 'myconfig.v1'.
Common situations: Forgetting the version/key suffix, or migrating from a loader with a different separator convention.
Related errors
- Invalid config {name!r}, expected format 'module.key'
- Module {mod_name!r} does not have CONFIGS
- Module '{base_module_name}' is not a package containing conf
- Invalid argument {arg!r}, not a key=value replacement and no
- Expected bool [True, true, False, false], got {val!r}
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/48ed17468b5ff24f.
Report an issue: GitHub.