xai-org/x-algorithm · error · ValueError

No absolute config module found {mod_name!r}

Error message

No absolute config module found {mod_name!r}

What it means

When importing the config module directly fails with ModuleNotFoundError and the name has more than one dot (depth > 1, i.e. an absolute dotted path), xrex refuses to guess and raises this ValueError rather than retrying under xrex.configs.

Source

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


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'"
            )

    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(

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Verify the absolute module path exists (has __init__.py at each level)
  2. If the module lives under xrex.configs, pass only the trailing part ('b.c:v1') so relative lookup applies
  3. Restore or fix the package layout the name refers to

Example fix

# before
get_named_config("xrex.configs.train.big:v1")  # if that path doesn't exist
# after
get_named_config("train.big:v1")  # resolved under xrex.configs
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util
assert importlib.util.find_spec(mod_name) is not None, f"absolute module missing: {mod_name}"

Prevention

When it happens

Trigger: get_named_config('a.b.c:v1') where 'a.b.c' doesn't exist as an importable absolute module — the loader won't try 'xrex.configs.a.b.c' because nested retry is ambiguous.

Common situations: Pointing at a config package moved/deleted, or assuming relative-to-xrex.configs resolution works for deeply nested paths.

Related errors


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