nautechsystems/nautilus_trader · error
Unknown DEX {dex_id} on chain {}
Error message
Unknown DEX {dex_id} on chain {} What it means
register_dex validates that the requested DEX type exists for the target chain via get_dex_extended. If there is no registry entry for this DEX on this chain (e.g. SushiSwap on a chain where it isn't indexed), registration cannot proceed and the error names both the DEX and chain.
Source
Thrown at crates/adapters/blockchain/src/data/core.rs:1430
/// absent from the cache database is left for the caller's later lookup to report.
///
/// # Errors
///
/// Returns an error if DEX registration or the pool load fails.
pub async fn register_dex_exchange_for_pool(
&mut self,
dex_id: DexType,
pool_identifier: &PoolIdentifier,
) -> anyhow::Result<()> {
self.register_dex(dex_id).await?;
let _ = self.cache.load_pool(&dex_id, pool_identifier).await?;
Ok(())
}
/// Registers a DEX in the cache and its event signatures for subscriptions, without loading pools.
async fn register_dex(&mut self, dex_id: DexType) -> anyhow::Result<()> {
let Some(dex_extended) = get_dex_extended(self.chain.name, &dex_id) else {
anyhow::bail!("Unknown DEX {dex_id} on chain {}", self.chain.name);
};
log::debug!("Registering DEX {dex_id} on chain {}", self.chain.name);
self.cache.add_dex(dex_extended.dex.clone()).await?;
self.subscription_manager.register_dex_for_subscriptions(
dex_id,
dex_extended.swap_created_event.as_ref(),
dex_extended.mint_created_event.as_ref(),
dex_extended.burn_created_event.as_ref(),
dex_extended.collect_created_event.as_ref(),
dex_extended.flash_created_event.as_deref(),
);
self.subscription_manager.register_dex_fee_protocol_events(
dex_id,
dex_extended.fee_protocol_update_event.as_deref(),
dex_extended.fee_protocol_collect_event.as_deref(),
);
Ok(())View on GitHub (pinned to 18893faf8b)
Solutions
- Check the supported DEX list for your chain and pick a valid DexType
- Correct the chain configuration if the DEX should exist on it
- Upgrade the library/dex-metadata dependency if the DEX was recently added upstream
Example fix
// before client.register_dex_exchange(chain, DexType::Camelot).await?; // not on this chain // after client.register_dex_exchange(chain, DexType::UniswapV3).await?; // supported on this chain
Defensive patterns
Strategy: validation
Validate before calling
if get_dex_extended(chain.name, dex_id).is_none() {
return Err(anyhow::anyhow!("DEX {:?} unsupported on {}", dex_id, chain.name));
}
client.register_dex_exchange(chain, dex_id).await?; Try / catch
if let Err(e) = client.register_dex_exchange(chain, dex).await {
if e.to_string().starts_with("Unknown DEX") {
log::warn!("{} unsupported on {}; skipping", dex, chain.name);
return Ok(()); // or fall back to a supported DEX
}
return Err(e);
} Prevention
- Validate the (chain, dex) pair against the supported list at config load
- Keep DEX enums and chain configs in sync after upgrades
- Test registration for every configured DEX on startup
When it happens
Trigger: Calling register_dex (directly or via register_dex_exchange / register_dex_exchange_for_pool) with a DexType not supported/indexed on the configured chain.
Common situations: Configuring a DEX on the wrong chain in the adapter config; typo in DEX id; DEX not yet supported by the underlying dex metadata registry for that network.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Dex {dex_id} doesn't exist for chain {}
- No DEX extended found for {} on {}
- DEX {dex_id:?} has not been registered
- no Lighter market_index registered for instrument {instrumen
- DEX '{dex_type}' is not registered on chain '{}'
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/c39e3f04a65b531d.
Report an issue: GitHub.