{"record":{"id":"430043672d11d078","repo":"nautechsystems/nautilus_trader","slug":"failed-to-get-config-class-config-class-name-e-430043","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/backtest/src/python/node.rs","lineNumber":521,"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":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/backtest/src/python/node.rs#L503-L539","documentation":"Raised by `create_config_instance` when the Python module imported successfully but `getattr(module, config_class_name)` failed — i.e. the expected configuration class does not exist under that name in the module. The library needs the class object to instantiate the component config, so a missing attribute aborts node creation. The wrapped `{e}` is the underlying Python AttributeError.","triggerScenarios":"`create_importable_component` is given a `config_class_name` string that is not an attribute of the imported module: misspelled class name, the class was renamed/moved to another module, or you passed the class's fully-qualified path in one string instead of splitting module and class.","commonSituations":"After a nautilus upgrade where config classes were renamed (e.g. `StrategyConfig` variations), a user config still references the old name; custom strategy configs defined in a different module than the one passed; passing a function or instance name instead of the config class name.","solutions":["Verify the class name spelling and that it exists: `python -c \"from <module> import <class>\"`","Update `config_class_name` after any rename, or import the class from the module where it is actually defined","Ensure you are passing the bare class name (e.g. `MyStrategyConfig`) as the class argument, not a dotted `module.Class` string","Check you imported the intended module — a same-named module shadowing the real one can hide the class"],"exampleFix":"// before\ncreate_importable_component(py, config, module=\"my_pkg.strategy\", class=\"MyStratConfig\")\n// after\ncreate_importable_component(py, config, module=\"my_pkg.strategy\", class=\"MyStrategyConfig\")","handlingStrategy":"validation","validationCode":"python -c \"import <module>; assert hasattr(<module>, '<ConfigClass>')\"","typeGuard":null,"tryCatchPattern":"match create_config_instance(...) {\n    Err(e) if e.to_string().contains(\"Failed to get config class\") => {\n        eprintln!(\"config class not found in module: {e:#}\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Keep module and class names in one config constant and derive them from the class itself (type(obj).__module__/__name__)","Grep/rename atomically with IDE refactors so class references stay in sync","Pin library versions and check changelogs for config class renames before upgrading"],"tags":["python","attributeerror","config","backtest"],"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-14T00:17:10.932Z"}