nautechsystems/nautilus_trader · error

No instruments loaded for configured types {instrument_types

Error message

No instruments loaded for configured types {instrument_types:?}, cannot initialize execution client

What it means

After fetching instruments for all configured types (and families), if `all_instruments` is still empty the execution client cannot be initialized, so `establish_session` bails. This is the aggregate guard: every configured type/family produced zero usable instruments.

Source

Thrown at crates/adapters/okx/src/execution.rs:1395

                                "No usable instruments for {instrument_type:?} family {family}, \
                                 cannot initialize execution client"
                            );
                        }

                        log::debug!(
                            "Loaded {} {instrument_type:?} instruments for family {family}",
                            instruments.len()
                        );

                        self.http_client.cache_instruments(&instruments);
                        all_instruments.extend(instruments);
                        all_inst_id_codes.extend(inst_id_codes);
                    }
                }
            }

            if all_instruments.is_empty() {
                anyhow::bail!(
                    "No instruments loaded for configured types {instrument_types:?}, \
                     cannot initialize execution client"
                );
            }

            self.ws_private.cache_instruments(&all_instruments);
            self.ws_private
                .cache_inst_id_codes(all_inst_id_codes.clone());
            self.ws_business.cache_instruments(&all_instruments);
            self.ws_business.cache_inst_id_codes(all_inst_id_codes);
            self.core.set_instruments_initialized();
        }

        self.ws_private.connect().await?;
        self.ws_private.wait_until_active(10.0).await?;
        log::info!("Connected to private WebSocket");

        {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Correct `instrument_types` in the execution client config to valid OKX types (SPOT, SWAP, FUTURES, OPTION).
  2. Verify with a direct OKX API call that instruments are returned for your parameters.
  3. Loosen any instrument filtering so at least one instrument is loaded.
  4. Retry; if OKX is returning empty payloads for all types, treat it as an upstream outage.

Example fix

// before
instrument_types = ["PERP", "FUTURE"]  // invalid OKX type names -> nothing loaded
// after
instrument_types = ["SWAP", "FUTURES"]
Defensive patterns

Strategy: validation

Validate before calling

let valid_okx_types = ["SPOT", "SWAP", "FUTURES", "OPTION"];
for t in &config.instrument_types {
    if !valid_okx_types.contains(&t.as_str()) {
        return Err(anyhow::anyhow!("invalid OKX instrument type: {t}"));
    }
}

Prevention

When it happens

Trigger: `connect` -> `establish_session` with a configuration whose `instrument_types` all yield empty instrument lists — e.g. an entirely invalid config, all requests failing to return data, or filtering (e.g. by allowed instruments) eliminating everything.

Common situations: Copy-pasted config from another venue with unsupported type names; all configured types unavailable in the account's region; overly restrictive instrument filters; systemic OKX API problem returning empty bodies.

Related errors


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