nautechsystems/nautilus_trader · error

Execution client '{name}' is already registered

Error message

Execution client '{name}' is already registered

What it means

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.

Source

Thrown at crates/live/src/node/builder.rs:509

        self.add_exec_client_with_routing(name, factory, config, RoutingConfig::default())
    }

    /// Adds an execution client factory with configuration and explicit routing.
    ///
    /// # Errors
    ///
    /// Returns an error if a client with the same name is already registered.
    pub fn add_exec_client_with_routing(
        mut self,
        name: Option<String>,
        factory: Box<dyn ExecutionClientFactory>,
        config: Box<dyn ClientConfig>,
        routing: RoutingConfig,
    ) -> anyhow::Result<Self> {
        let name = name.unwrap_or_else(|| factory.name().to_string());

        if self.exec_client_factories.contains_key(&name) {
            anyhow::bail!("Execution client '{name}' is already registered");
        }

        self.exec_client_factories
            .insert(name.clone(), ExecutionClientFactoryEntry::Adapter(factory));
        self.exec_client_configs.insert(name.clone(), config);
        self.exec_client_routing.insert(name, routing);
        Ok(self)
    }

    /// Add a simulated execution client factory.
    ///
    /// This path is for sync-core clients such as the sandbox matching engine, which owns cache
    /// mutation. Live venue adapters should use [`Self::add_exec_client`].
    ///
    /// # Errors
    ///
    /// Returns an error if a client with the same name is already registered.
    pub fn add_simulated_exec_client(

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Provide a unique explicit client name: `add_exec_client_with_routing(Some("exec-unique".into()), ...)`.
  2. Audit the builder code/config for duplicate `add_exec_client` registrations.
  3. Construct a fresh `NodeBuilder` if the build must be repeated.

Example fix

// before
.add_exec_client(None, bybit_exec_factory, exec_config)?
.add_exec_client(None, bybit_exec_factory, exec_config2)?

// after
.add_exec_client(None, bybit_exec_factory, exec_config)?
.add_exec_client_with_routing(Some("bybit-exec-2".into()), bybit_exec_factory, exec_config2, routing)?
Defensive patterns

Strategy: validation

Validate before calling

let name = name.unwrap_or_else(|| factory.name().to_string());
if builder_has_exec_client(&builder, &name) {
    return Err(anyhow::anyhow!("execution client '{name}' already registered"));
}

Try / catch

match builder.add_exec_client_with_routing(name, factory, config, routing) {
    Ok(b) => b,
    Err(e) if e.to_string().contains("already registered") => {
        // skip duplicate or use a unique name and retry
        builder
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

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

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

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


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