{"record":{"id":"8c80de3abba9bf94","repo":"xai-org/x-algorithm","slug":"module-mod-name-r-does-not-have-configs","errorCode":null,"errorMessage":"Module {mod_name!r} does not have CONFIGS","messagePattern":"Module (.+?) does not have CONFIGS","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phoenix/python/common/xai-configlib/src/xai_configlib/__init__.py","lineNumber":593,"sourceCode":") -> Config:\n    parts = name.split(\".\", 1)\n    if len(parts) < 2:\n        raise ValueError(f\"Invalid config {name!r}, expected format 'module.key'\")\n\n    mod_name, ver = parts\n    try:\n        mod = get_module(f\"{base_module_name}.{mod_name}\")\n    except ModuleNotFoundError as e:\n        if on_failure_log_additional_info:\n            discovered_configs = get_all_configs_from_module(\n                base_module_name, ignore_loading_errors=True\n            )\n            available_configs = sorted(discovered_configs.configs.keys())\n            print(f\"Available configs: {available_configs}\")\n        raise e\n    configs = get_configs_from_mod(mod)\n    if configs is None:\n        raise ValueError(f\"Module {mod_name!r} does not have CONFIGS\")\n\n    if ver not in configs:\n        avail = \", \".join(configs.keys())\n        raise ValueError(f\"Config module {mod_name!r} has no key {ver!r}. Available keys: {avail}\")\n    return configs[ver]\n\n\nclass DiscoveredConfigsInModule(NamedTuple):\n    configs: dict[str, Config]\n    failing_modules: list[str]\n\n\ndef get_all_configs_from_module(\n    base_module_name: str,\n    ignore_loading_errors: bool = False,\n) -> DiscoveredConfigsInModule:\n    mod = get_module(base_module_name)\n    if not hasattr(mod, \"__path__\"):","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/python/common/xai-configlib/src/xai_configlib/__init__.py#L575-L611","documentation":"After successfully importing the target config module, get_named_config_from_module expects a module-level CONFIGS mapping. If get_configs_from_mod returns None (no CONFIGS attribute), this ValueError is raised.","triggerScenarios":"The module under the base package imports fine but defines no CONFIGS dict (e.g. it's a helper module, or CONFIGS was renamed to configs/_CONFIGS).","commonSituations":"Refactoring config modules and dropping the CONFIGS convention, or pointing the loader at a utility module rather than a config module.","solutions":["Add a module-level CONFIGS: dict[str, Config] to the module","Rename any legacy variable back to CONFIGS","Point the name at a module that actually declares CONFIGS"],"exampleFix":"# before\n# my_cfg.py\nconfigs = {\"v1\": Config()}\n# after\nCONFIGS = {\"v1\": Config()}","handlingStrategy":"validation","validationCode":"import importlib\nmod = importlib.import_module(f\"{base}.{mod_name}\")\nassert hasattr(mod, \"CONFIGS\"), f\"{mod_name} lacks CONFIGS\"","typeGuard":"def has_configs(mod) -> bool:\n    return hasattr(mod, \"CONFIGS\") and isinstance(getattr(mod, \"CONFIGS\"), dict)","tryCatchPattern":null,"preventionTips":["Lint config modules to require a CONFIGS dict","Name the variable CONFIGS exactly"],"tags":["config","module-resolution","validation"],"backgroundTag":"missing-config-attribute","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}