{"record":{"id":"03a95be633f24da9","repo":"nautechsystems/nautilus_trader","slug":"execution-client-name-is-already-registered","errorCode":null,"errorMessage":"Execution client '{name}' is already registered","messagePattern":"Execution client '(.+?)' is already registered","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/live/src/node/builder.rs","lineNumber":509,"sourceCode":"        self.add_exec_client_with_routing(name, factory, config, RoutingConfig::default())\n    }\n\n    /// Adds an execution client factory with configuration and explicit routing.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if a client with the same name is already registered.\n    pub fn add_exec_client_with_routing(\n        mut self,\n        name: Option<String>,\n        factory: Box<dyn ExecutionClientFactory>,\n        config: Box<dyn ClientConfig>,\n        routing: RoutingConfig,\n    ) -> anyhow::Result<Self> {\n        let name = name.unwrap_or_else(|| factory.name().to_string());\n\n        if self.exec_client_factories.contains_key(&name) {\n            anyhow::bail!(\"Execution client '{name}' is already registered\");\n        }\n\n        self.exec_client_factories\n            .insert(name.clone(), ExecutionClientFactoryEntry::Adapter(factory));\n        self.exec_client_configs.insert(name.clone(), config);\n        self.exec_client_routing.insert(name, routing);\n        Ok(self)\n    }\n\n    /// Add a simulated execution client factory.\n    ///\n    /// This path is for sync-core clients such as the sandbox matching engine, which owns cache\n    /// mutation. Live venue adapters should use [`Self::add_exec_client`].\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if a client with the same name is already registered.\n    pub fn add_simulated_exec_client(","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/live/src/node/builder.rs#L491-L527","documentation":"Thrown by `add_exec_client_with_routing` on the live node `NodeBuilder` when an execution client factory is registered under a name already present in `exec_client_factories`. Execution client names must be unique to keep the routing and config maps consistent.","triggerScenarios":"Calling `add_exec_client(...)` / `add_exec_client_with_routing(...)` twice with the same name (explicit or derived from `factory.name()`), e.g. registering the same exec adapter twice or re-invoking a builder function.","commonSituations":"Duplicate exec client entries in the trading node config; same venue exec adapter registered under its default name twice; re-running builder setup on an already-populated builder.","solutions":["Provide a unique explicit client name: `add_exec_client_with_routing(Some(\"exec-unique\".into()), ...)`.","Audit the builder code/config for duplicate `add_exec_client` registrations.","Construct a fresh `NodeBuilder` if the build must be repeated."],"exampleFix":"// before\n.add_exec_client(None, bybit_exec_factory, exec_config)?\n.add_exec_client(None, bybit_exec_factory, exec_config2)?\n\n// after\n.add_exec_client(None, bybit_exec_factory, exec_config)?\n.add_exec_client_with_routing(Some(\"bybit-exec-2\".into()), bybit_exec_factory, exec_config2, routing)?","handlingStrategy":"validation","validationCode":"let name = name.unwrap_or_else(|| factory.name().to_string());\nif builder_has_exec_client(&builder, &name) {\n    return Err(anyhow::anyhow!(\"execution client '{name}' already registered\"));\n}","typeGuard":null,"tryCatchPattern":"match builder.add_exec_client_with_routing(name, factory, config, routing) {\n    Ok(b) => b,\n    Err(e) if e.to_string().contains(\"already registered\") => {\n        // skip duplicate or use a unique name and retry\n        builder\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Assign explicit unique names to each exec client registration.","Keep registration code in a single builder function to avoid double invocation.","Validate the node config for duplicate exec client entries before startup."],"tags":["configuration","duplicate-registration","live-trading","rust"],"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"}