{"record":{"id":"9ac55751da8f0cbf","repo":"nautechsystems/nautilus_trader","slug":"failed-to-get-config-class-config-class-name-e-9ac557","errorCode":null,"errorMessage":"Failed to get config class {config_class_name}: {e}","messagePattern":"Failed to get config class (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/live/src/python/node.rs","lineNumber":1800,"sourceCode":"        return Ok(None);\n    }\n\n    let config_parts: Vec<&str> = config_path.split(':').collect();\n    if config_parts.len() != 2 {\n        anyhow::bail!(\"config_path must be in format 'module.path:ClassName', was {config_path}\");\n    }\n    let (config_module_name, config_class_name) = (config_parts[0], config_parts[1]);\n\n    log::debug!(\n        \"Importing config class from module: {config_module_name} class: {config_class_name}\"\n    );\n\n    let config_module = py\n        .import(config_module_name)\n        .map_err(|e| anyhow::anyhow!(\"Failed to import config module {config_module_name}: {e}\"))?;\n    let config_class = config_module\n        .getattr(config_class_name)\n        .map_err(|e| anyhow::anyhow!(\"Failed to get config class {config_class_name}: {e}\"))?;\n\n    // Convert config dict to Python dict\n    let py_dict = PyDict::new(py);\n\n    for (key, value) in config {\n        let py_value = config_value_to_py(py, key, value)?;\n        py_dict.set_item(key, py_value)?;\n    }\n\n    log::debug!(\"Created config dict: {py_dict:?}\");\n\n    // Try kwargs first, then default constructor with setattr\n    let config_instance = match config_class.call((), Some(&py_dict)) {\n        Ok(instance) => {\n            log::debug!(\"Created config instance with kwargs\");\n            instance\n        }\n        Err(kwargs_err) => {","sourceCodeStart":1782,"sourceCodeEnd":1818,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/live/src/python/node.rs#L1782-L1818","documentation":"Raised when the config module imported successfully but getattr(config_class_name) fails — the named config class is not an attribute of the module (embedded AttributeError). The node cannot build the config instance for the strategy/exec algorithm.","triggerScenarios":"config_path \"module:Class\" where the class name is misspelled, the class was renamed/moved, or the module does not re-export it at top level.","commonSituations":"Renaming a *Config dataclass during refactor without updating the node config; pointing at the wrong module; expecting a re-export that isn't in __all__/__init__.","solutions":["Verify with python -c \"from <module> import <config_class_name>\"","Update config_path to the current module:Class name","Add or use the module that actually defines the config class","Check __init__.py re-exports if pointing at a package"],"exampleFix":"// before\nconfig_path=\"myproj.cfg:StratConfig\"  # renamed\n// after\nconfig_path=\"myproj.cfg:StrategyConfig\"","handlingStrategy":"validation","validationCode":"import importlib\nmod, cls = config_path.split(\":\")\nassert hasattr(importlib.import_module(mod), cls), f\"{cls} missing from {mod}\"","typeGuard":"def config_class_exists(config_path: str) -> bool:\n    import importlib\n    mod, cls = config_path.split(\":\")\n    return hasattr(importlib.import_module(mod), cls)","tryCatchPattern":"try:\n    node.add_strategy_from_config(cfg)\nexcept Exception as e:\n    if \"Failed to get config class\" in str(e):\n        print(\"Update config_path; class not found:\", cfg.config_path)\n    raise","preventionTips":["Rename config classes together with their config_path references","Keep re-exports in package __init__ if pointing at packages","Validate every config_path in CI before deployment"],"tags":["python","config","attribute"],"backgroundTag":"class-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}