{"record":{"id":"123031e72844cb0c","repo":"nautechsystems/nautilus_trader","slug":"execution-factory-extractor-name-is-already-re","errorCode":null,"errorMessage":"Execution factory extractor '{name}' is already registered","messagePattern":"Execution factory extractor '(.+?)' is already registered","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/system/src/python/registry.rs","lineNumber":119,"sourceCode":"\n        extractors.insert(type_name, extractor);\n        Ok(())\n    }\n\n    /// Registers an execution factory extractor for a specific factory name.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if a factory with the same name is already registered.\n    pub fn register_exec_factory_extractor(\n        &self,\n        name: String,\n        extractor: ExecutionFactoryExtractor,\n    ) -> anyhow::Result<()> {\n        let mut extractors = self.exec_factory_extractors.lock();\n\n        if extractors.contains_key(&name) {\n            anyhow::bail!(\"Execution factory extractor '{name}' is already registered\");\n        }\n        extractors.insert(name, extractor);\n        Ok(())\n    }\n\n    /// Registers a simulated execution factory extractor for a specific factory name.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if a factory with the same name is already registered.\n    pub fn register_sim_exec_factory_extractor(\n        &self,\n        name: String,\n        extractor: SimulatedExecutionFactoryExtractor,\n    ) -> anyhow::Result<()> {\n        let mut extractors = self.sim_exec_factory_extractors.lock();\n\n        if extractors.contains_key(&name) {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/system/src/python/registry.rs#L101-L137","documentation":"Duplicate-registration guard in the Python system registry's register_exec_factory_extractor: an execution factory extractor with the same name is already registered, so the second registration would silently overwrite it and is rejected.","triggerScenarios":"Calling the public register_exec_factory_extractor twice with the same `name`, e.g. double plugin registration, module reload, or two exec client adapters sharing a name.","commonSituations":"Re-running system kernel/node setup in the same process (tests, notebooks), importing a third-party exec factory twice, name collisions between venue adapters.","solutions":["Make registration idempotent — register once per process.","Use a distinct name for custom exec factories.","If re-running in a notebook, recreate the registry/kernel instead of re-registering."],"exampleFix":"// before\nregister_exec_factory_extractor(\"MyExecClient\", factory)  # second call fails\n// after\nif \"MyExecClient\" not in registered_names:\n    register_exec_factory_extractor(\"MyExecClient\", factory)","handlingStrategy":"try-catch","validationCode":"if name in registered_exec_factories:\n    return\nregistered_exec_factories.add(name)\nregister_exec_factory_extractor(name, factory)","typeGuard":"def exec_factory_registered(name: str, names: set) -> bool:\n    return name in names","tryCatchPattern":"try:\n    register_exec_factory_extractor(name, factory)\nexcept Exception as e:\n    if \"is already registered\" in str(e):\n        pass  # idempotent re-setup\n    else:\n        raise","preventionTips":["Wrap exec factory registration in an idempotent setup function","Use unique adapter names per venue/factory","Don't re-run node setup cells/notebook code in the same process"],"tags":["registration","duplicate","execution","factory"],"backgroundTag":"file-already-exists","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"}