{"record":{"id":"11a5c85b2db0695d","repo":"nautechsystems/nautilus_trader","slug":"no-client-registered-with-id-client-id","errorCode":null,"errorMessage":"No client registered with ID {client_id}","messagePattern":"No client registered with ID (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/data/src/engine/mod.rs","lineNumber":524,"sourceCode":"        let client_id = client.client_id();\n        self.clients.insert(client_id, client);\n        self.default_client_id = Some(client_id);\n        log::debug!(\"Registered default client {client_id}\");\n    }\n\n    /// Marks an already-registered client as the default for fallback routing.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if no client is registered with the given ID, or a different\n    /// client is already the default.\n    pub fn set_default_client(&mut self, client_id: ClientId) -> anyhow::Result<()> {\n        if self.default_client_id.is_some_and(|id| id != client_id) {\n            anyhow::bail!(\"default client already registered\");\n        }\n\n        if !self.clients.contains_key(&client_id) {\n            anyhow::bail!(\"No client registered with ID {client_id}\");\n        }\n        self.default_client_id = Some(client_id);\n        log::debug!(\"Set client {client_id} as default\");\n        Ok(())\n    }\n\n    /// Sets routing for a specific venue to a given client ID.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the client ID is not registered, or the venue is already routed to a\n    /// different client.\n    pub fn register_venue_routing(\n        &mut self,\n        client_id: ClientId,\n        venue: Venue,\n    ) -> anyhow::Result<()> {\n        if !self.clients.contains_key(&client_id) {","sourceCodeStart":506,"sourceCodeEnd":542,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/data/src/engine/mod.rs#L506-L542","documentation":"set_default_client requires the ClientId to already exist in the engine's registered clients map before it can be made the default. If no client with that ID was previously registered (via the client registration API), the engine bails with this message instead of silently setting a dangling default. It also refuses to change an existing default to a different client.","triggerScenarios":"Calling DataEngine::set_default_client(client_id) with a ClientId that was never registered via the client registration path (clients map does not contain the key), or with an ID different from the already-set default.","commonSituations":"Typo or case mismatch in the client ID string; building the engine from config where clients are registered by adapter name that differs from the routing/default client name; calling set_default_client before registering clients during engine initialization.","solutions":["Register the client with that ClientId first (clients.contains_key must be true), then call set_default_client.","Print/log the registered client IDs and confirm the exact spelling and case of the ClientId you pass.","If a default is already set and you intend to replace it, clear or update the default through the appropriate API rather than calling set_default_client with a different ID."],"exampleFix":"// before\nengine.set_default_client(ClientId::from(\"BinanceSpot\"))?;\n// after\nengine.register_client(client_for(ClientId::from(\"BinanceSpot\")))?;\nengine.set_default_client(ClientId::from(\"BinanceSpot\"))?;","handlingStrategy":"validation","validationCode":"// Rust\n// ensure the client exists before making it default\nif engine.clients().iter().all(|id| id != &target_id) {\n    return Err(format!(\"client {target_id} not registered\"));\n}\nengine.set_default_client(target_id)?;","typeGuard":null,"tryCatchPattern":"// Rust\nmatch engine.set_default_client(client_id) {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"No client registered\") => {\n        log::error!(\"register client {client_id} first: {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Register all clients as the first step of engine initialization, before any routing/default configuration.","Keep client ID constants in one place to avoid case/typo drift.","Log the registered client ID set during startup for quick diffing against config."],"tags":["rust","data-engine","client-registration","config"],"backgroundTag":"resource-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"}