{"record":{"id":"ed741c231a13ce46","repo":"xai-org/x-algorithm","slug":"no-config-module-mod-name-r-found-either-at-the","errorCode":null,"errorMessage":"No config module {mod_name!r} found, either at the top level or under 'xrex.configs'","messagePattern":"No config module (.+?) found, either at the top level or under 'xrex\\.configs'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/xrex/configs/config_loader.py","lineNumber":98,"sourceCode":"    else:\n        parts = name.rsplit(\".\", 1)\n        if len(parts) < 2:\n            raise ValueError(\n                f\"Invalid config {name!r}, expected format 'module.key' where key cannot contain '.'\"\n            )\n        mod_name, ver = parts\n\n    try:\n        mod = importlib.import_module(mod_name)\n    except ModuleNotFoundError:\n        depth = mod_name.count(\".\")\n        if depth > 1:\n            raise ValueError(f\"No absolute config module found {mod_name!r}\")\n\n        try:\n            mod = importlib.import_module(f\"xrex.configs.{mod_name}\")\n        except ModuleNotFoundError:\n            raise ValueError(\n                f\"No config module {mod_name!r} found, either at the top level or under 'xrex.configs'\"\n            )\n\n    if not hasattr(mod, \"CONFIGS\"):\n        raise ValueError(\"Your config needs a global variable named CONFIGS\")\n\n    configs = mod.CONFIGS\n    if ver not in configs:\n        logger.warning(\n            f\"Couldn't find a valid config ({len(configs)=}), searching for closest matches...\"\n        )\n        closest_matches = difflib.get_close_matches(ver, configs, n=5, cutoff=0)\n        raise ValueError(\n            f\"Config module {mod_name!r} has no key {ver!r}. Closest matches: {closest_matches}\"\n        )\n    return _apply_deployment_defaults(configs[ver])\n","sourceCodeStart":80,"sourceCodeEnd":115,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/configs/config_loader.py#L80-L115","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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')"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import importlib.util\nok = importlib.util.find_spec(mod_name) or importlib.util.find_spec(f\"xrex.configs.{mod_name}\")\nassert ok, f\"config module not found: {mod_name}\"","typeGuard":null,"tryCatchPattern":"try:\n    get_named_config(name)\nexcept ValueError as e:\n    if \"No config module\" in str(e):\n        list_available = __import__(\"pkgutil\").iter_modules(__import__(\"xrex.configs\", fromlist=[\"x\"]).__path__)\n        print(\"Available:\", [n for _, n, _ in list_available])\n    raise","preventionTips":["Ensure configs are committed and packaged","Print available config modules in CLI help"],"tags":["config","import","module-resolution"],"backgroundTag":"module-not-found","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}