{"record":{"id":"d90f7beb3c234f2c","repo":"nautechsystems/nautilus_trader","slug":"cannot-handle-request-no-client-found-for","errorCode":null,"errorMessage":"Cannot handle request: no client found for {:?} {:?}","messagePattern":"Cannot handle request: no client found for (.+?) (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/data/src/defi/engine.rs","lineNumber":219,"sourceCode":"    /// # Errors\n    ///\n    /// Returns an error if no client is found for the given client ID or venue,\n    /// or if the client fails to process the request.\n    pub fn execute_defi_request(&mut self, req: DefiRequestCommand) -> anyhow::Result<()> {\n        // Skip requests for external clients\n        if let Some(cid) = req.client_id()\n            && self.external_clients.contains(cid)\n        {\n            if self.config.debug {\n                log::debug!(\"Skipping defi data request for external client {cid}: {req:?}\");\n            }\n            return Ok(());\n        }\n\n        if let Some(client) = self.get_client(req.client_id(), req.venue()) {\n            client.execute_defi_request(req)\n        } else {\n            anyhow::bail!(\n                \"Cannot handle request: no client found for {:?} {:?}\",\n                req.client_id(),\n                req.venue()\n            );\n        }\n    }\n\n    /// Processes DeFi-specific data events.\n    pub fn process_defi_data(&mut self, data: DefiData) {\n        self.increment_data_count();\n\n        match data {\n            DefiData::Block(block) => {\n                let topic = defi::switchboard::get_defi_blocks_topic(block.chain());\n                msgbus::publish_defi_block(topic, &block);\n            }\n            DefiData::Pool(pool) => {\n                if let Err(e) = self.cache.borrow_mut().add_pool(pool.clone()) {","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/data/src/defi/engine.rs#L201-L237","documentation":"`execute_defi_request` on the DataEngine looks up the registered data client matching the request's client_id and venue, then forwards the DeFi request to it. This error means no registered client matches, so the engine cannot route the request anywhere. It is a routing/registration failure, not a network failure.","triggerScenarios":"Calling `execute`/`execute_defi_request` with a request whose `client_id` was never registered via the client registration path (`setup_pool_updater` registers clients), or whose `venue` does not match the venue the client was registered for.","commonSituations":"Submitting DeFi requests before client startup/registration completes; a typo or mismatch between the client_id used when registering and the one on the request; requesting a venue the client doesn't support; clients unregistered on disconnect.","solutions":["Register the data client for the request's client_id/venue before executing (check the setup path, e.g. setup_pool_updater)","Log/inspect the request's client_id and venue and compare against the engine's registered clients","Fix client_id mismatches (the client_id the client registered with must equal the one on the request)","Ensure client startup completes before any requests are submitted"],"exampleFix":"// before\nengine.execute(req)?; // req.venue() never registered\n// after\nif engine.get_client(req.client_id(), req.venue()).is_none() {\n    tracing::error!(\"no client for {:?} {:?}\", req.client_id(), req.venue());\n    return; // or register the client first\n}\nengine.execute(req)?;","handlingStrategy":"try-catch","validationCode":"// check routability before executing\nif engine.get_client(req.client_id(), req.venue()).is_none() {\n    tracing::error!(\"no client registered for {:?} {:?}\", req.client_id(), req.venue());\n    return; // or register first\n}\nengine.execute(req)?;","typeGuard":null,"tryCatchPattern":"match engine.execute(req) {\n    Ok(()) => (),\n    Err(e) if e.to_string().starts_with(\"Cannot handle request\") => {\n        tracing::error!(\"client not registered: {e}\"); // defer or register client\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Only submit requests after client registration/startup completes","Keep client_id constants shared between registration and request creation","Verify venue support before sending venue-specific DeFi requests"],"tags":["rust","routing","defi","client-registration"],"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"}