{"record":{"id":"3745e50b4e65c35f","repo":"nautechsystems/nautilus_trader","slug":"data-client-name-is-already-registered","errorCode":null,"errorMessage":"Data client '{name}' is already registered","messagePattern":"Data client '(.+?)' is already registered","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/live/src/node/builder.rs","lineNumber":468,"sourceCode":"        self.add_data_client_with_routing(name, factory, config, RoutingConfig::default())\n    }\n\n    /// Adds a data 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_data_client_with_routing(\n        mut self,\n        name: Option<String>,\n        factory: Box<dyn DataClientFactory>,\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.data_client_factories.contains_key(&name) {\n            anyhow::bail!(\"Data client '{name}' is already registered\");\n        }\n\n        self.data_client_factories.insert(name.clone(), factory);\n        self.data_client_configs.insert(name.clone(), config);\n        self.data_client_routing.insert(name, routing);\n        Ok(self)\n    }\n\n    /// Adds an execution client factory with configuration.\n    ///\n    /// Equivalent to [`Self::add_exec_client_with_routing`] with default (empty)\n    /// 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(\n        self,","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/live/src/node/builder.rs#L450-L486","documentation":"Thrown by `add_data_client_with_routing` on the live node `NodeBuilder` when a data client factory is registered under a name that already exists in `data_client_factories`. Each data client must have a unique name so configs and routing tables stay unambiguous.","triggerScenarios":"Calling `add_data_client(...)` / `add_data_client_with_routing(...)` twice with the same name (explicit name or the factory's default `factory.name()`), typically inside a node build function executed twice or an adapter registered twice.","commonSituations":"Duplicate adapter registration in the trading node config; two instances of the same data client configured without distinct names; building the builder twice while reusing the same builder instance.","solutions":["Give each data client registration a unique explicit name: `add_data_client_with_routing(Some(\"my-unique-name\".into()), ...)`.","Audit your node builder code for duplicate `add_data_client` calls or double invocation.","If intentionally re-registering, create a fresh `NodeBuilder` instead of reusing the populated one."],"exampleFix":"// before: duplicate default names\n.add_data_client(None, binance_factory, config)?\n.add_data_client(None, binance_factory, config2)?\n\n// after: unique explicit names\n.add_data_client(None, binance_factory, config)?\n.add_data_client_with_routing(Some(\"binance-2\".into()), binance_factory, config2, routing)?","handlingStrategy":"validation","validationCode":"let name = name.unwrap_or_else(|| factory.name().to_string());\nif builder_has_data_client(&builder, &name) {\n    return Err(anyhow::anyhow!(\"data client '{name}' already registered\"));\n}","typeGuard":null,"tryCatchPattern":"match builder.add_data_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":["Give every data client an explicit unique name instead of relying on factory defaults.","Centralize client registration in one function invoked exactly once.","Grep configs for duplicated adapter entries before building the node."],"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"}