xai-org/x-algorithm · error · ValueError
No config module {mod_name!r} found, either at the top level
Error message
No config module {mod_name!r} found, either at the top level or under 'xrex.configs' What it means
Fallback lookup: after both the direct import and 'xrex.configs.<mod_name>' fail with ModuleNotFoundError, xrex raises this ValueError stating the module wasn't found at either location.
Source
Thrown at phoenix/xrex/configs/config_loader.py:98
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'"
)
if not hasattr(mod, "CONFIGS"):
raise ValueError("Your config needs a global variable named CONFIGS")
configs = mod.CONFIGS
if ver not in configs:
logger.warning(
f"Couldn't find a valid config ({len(configs)=}), searching for closest matches..."
)
closest_matches = difflib.get_close_matches(ver, configs, n=5, cutoff=0)
raise ValueError(
f"Config module {mod_name!r} has no key {ver!r}. Closest matches: {closest_matches}"
)
return _apply_deployment_defaults(configs[ver])
View on GitHub (pinned to 24c60942c5)
Solutions
- Check spelling of mod_name against files under xrex/configs/
- Ensure the config module file exists and is committed/packaged
- Confirm xrex is importable in the current environment (pip show / python -c 'import xrex.configs')
Defensive patterns
Strategy: try-catch
Validate before calling
import importlib.util
ok = importlib.util.find_spec(mod_name) or importlib.util.find_spec(f"xrex.configs.{mod_name}")
assert ok, f"config module not found: {mod_name}" Try / catch
try:
get_named_config(name)
except ValueError as e:
if "No config module" in str(e):
list_available = __import__("pkgutil").iter_modules(__import__("xrex.configs", fromlist=["x"]).__path__)
print("Available:", [n for _, n, _ in list_available])
raise Prevention
- Ensure configs are committed and packaged
- Print available config modules in CLI help
When it happens
Trigger: get_named_config('foo:v1') where neither a top-level 'foo' module nor 'xrex.configs.foo' exists (shallow names only; deeper paths hit error 298 instead).
Common situations: Typos in config module names, config file not committed/present in the deployed environment, or running from a workspace where xrex.configs isn't installed.
Related errors
- No config module found {mod_name!r} under 'xrex.configs', or
- No absolute config module found {mod_name!r}
- 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
AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28).
Data as JSON: /api/errors/ed741c231a13ce46.
Report an issue: GitHub.