xai-org/x-algorithm · error · ValueError

No config module found {mod_name!r} under 'xrex.configs', or

Error message

No config module found {mod_name!r} under 'xrex.configs', or {mod_name!r} has another import issue: {traceback.format_exc()}

What it means

xrex's get_config_module imports xrex.configs.<mod_name> and wraps any ImportError in a ValueError that embeds the full traceback, because a missing module and a broken module (syntax error, failing import inside it) look identical.

Source

Thrown at phoenix/xrex/configs/config_loader.py:46

    "timeout.checkpoint=999999",
]

PRESETS["no_health"] = [
    "allow_unschedulable_nodes=True",
]

PRESETS["no_checkpointing"] = [
    "checkpoint_every_n=0",
    "save_final_checkpoint=False",
    "from_checkpoint=False",
]


def get_config_module(mod_name: str) -> dict[str, Config]:
    try:
        return importlib.import_module(f"xrex.configs.{mod_name}")
    except ImportError as e:
        raise ValueError(
            f"No config module found {mod_name!r} under 'xrex.configs', "
            f"or {mod_name!r} has another import issue: {traceback.format_exc()}"
        ) from e


def replace_cli_subs(config: Any, kvs: list[str]) -> tuple[Any, dict[str, list[str]]]:
    return xai_configlib.replace_cli_subs(config, kvs, PRESETS)


def replace_and_validate_cli_subs(config: Any, kvs: list[str]) -> Any:
    config, used = xai_configlib.replace_cli_subs(config, kvs, PRESETS)
    for k, v in used.items():
        if not v:
            raise ValueError(f"Unused KV pairs: {k}")
        elif len(v) > 1:
            logger.warning(f"{k} matches multiple paths: {v}")
    return config

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Read the embedded traceback: if it's not ModuleNotFoundError for the config module itself, fix the failing import inside your config
  2. Fix the module-name typo
  3. Install/ensure dependencies the config imports are available
  4. Run from an environment where the xrex package is installed/importable
Defensive patterns

Strategy: try-catch

Validate before calling

import importlib.util
spec = importlib.util.find_spec(f"xrex.configs.{mod_name}")
assert spec is not None, f"no such config module: {mod_name}"

Try / catch

try:
    get_config_module(mod_name)
except ValueError as e:
    # traceback is embedded; surface it for diagnosis
    logging.error("config import failed:\n%s", e)
    raise

Prevention

When it happens

Trigger: Calling get_config_module with a nonexistent module name, or one whose file imports something unavailable (missing dependency, typo'd import) — both raise this.

Common situations: Typos in config names, new configs importing libraries not installed in the env, config modules referencing symbols moved during refactors, or running outside the repo so xrex.configs isn't importable.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/38c6518e96ccea13. Report an issue: GitHub.