nautechsystems/nautilus_trader · error

No client registered with ID {client_id}

Error message

No client registered with ID {client_id}

What it means

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.

Source

Thrown at crates/data/src/engine/mod.rs:524

        let client_id = client.client_id();
        self.clients.insert(client_id, client);
        self.default_client_id = Some(client_id);
        log::debug!("Registered default client {client_id}");
    }

    /// Marks an already-registered client as the default for fallback routing.
    ///
    /// # Errors
    ///
    /// Returns an error if no client is registered with the given ID, or a different
    /// client is already the default.
    pub fn set_default_client(&mut self, client_id: ClientId) -> anyhow::Result<()> {
        if self.default_client_id.is_some_and(|id| id != client_id) {
            anyhow::bail!("default client already registered");
        }

        if !self.clients.contains_key(&client_id) {
            anyhow::bail!("No client registered with ID {client_id}");
        }
        self.default_client_id = Some(client_id);
        log::debug!("Set client {client_id} as default");
        Ok(())
    }

    /// Sets routing for a specific venue to a given client ID.
    ///
    /// # Errors
    ///
    /// Returns an error if the client ID is not registered, or the venue is already routed to a
    /// different client.
    pub fn register_venue_routing(
        &mut self,
        client_id: ClientId,
        venue: Venue,
    ) -> anyhow::Result<()> {
        if !self.clients.contains_key(&client_id) {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Register the client with that ClientId first (clients.contains_key must be true), then call set_default_client.
  2. Print/log the registered client IDs and confirm the exact spelling and case of the ClientId you pass.
  3. 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.

Example fix

// before
engine.set_default_client(ClientId::from("BinanceSpot"))?;
// after
engine.register_client(client_for(ClientId::from("BinanceSpot")))?;
engine.set_default_client(ClientId::from("BinanceSpot"))?;
Defensive patterns

Strategy: validation

Validate before calling

// Rust
// ensure the client exists before making it default
if engine.clients().iter().all(|id| id != &target_id) {
    return Err(format!("client {target_id} not registered"));
}
engine.set_default_client(target_id)?;

Try / catch

// Rust
match engine.set_default_client(client_id) {
    Ok(()) => {},
    Err(e) if e.to_string().contains("No client registered") => {
        log::error!("register client {client_id} first: {e}");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/11a5c85b2db0695d. Report an issue: GitHub.