nautechsystems/nautilus_trader · error · anyhow::Error

No DEX extended found for {} on {}

Error message

No DEX extended found for {} on {}

What it means

The chain and DexType were resolved, but `get_dex_extended` found no extended DEX metadata entry for that (chain, dex) combination. The extended record supplies the canonical DEX identity used to build the pool's instrument ID, so loading cannot continue without it. This is a registry-consistency error, not a data corruption error.

Source

Thrown at crates/adapters/blockchain/src/cache/database.rs:2543

                    transaction_index,
                    log_index,
                )
                .await?;

            let dex_name = row
                .try_get::<Option<String>, _>("dex_name")?
                .ok_or_else(|| {
                    anyhow::anyhow!("Missing dex_name for pool snapshot {}", pool_identifier)
                })?;
            let chain = Chain::from_chain_id(chain_id)
                .ok_or_else(|| anyhow::anyhow!("Unknown chain_id: {chain_id}"))?;

            let dex_type = DexType::from_dex_name(&dex_name)
                .ok_or_else(|| anyhow::anyhow!("Unknown dex_name: {dex_name}"))?;

            let dex_extended = crate::exchanges::get_dex_extended(chain.name, &dex_type)
                .ok_or_else(|| {
                    anyhow::anyhow!("No DEX extended found for {} on {}", dex_name, chain.name)
                })?;

            let instrument_id =
                Pool::create_instrument_id(chain.name, &dex_extended.dex, pool_identifier.as_ref());

            Ok(Some(PoolSnapshot::new(
                instrument_id,
                state,
                positions,
                ticks,
                analytics,
                block_position,
                timestamp, // ts_event
                timestamp, // ts_init (same block timestamp)
            )))
        } else {
            Ok(None)
        }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Add the missing (chain, dex) entry to the `get_dex_extended` registry / exchanges module.
  2. Verify the DEX actually exists on that chain; delete snapshots for invalid chain/DEX combos.
  3. Check whether the snapshot row's chain_id and dex_name were crossed (row written with the wrong chain).
  4. Add a write-time validation that get_dex_extended(chain, dex) resolves before persisting a snapshot.

Example fix

// exchanges registry
// before: entry missing for new chain
// after
DexExtended::new(Chain::Base, DexType::UniswapV3, "uniswap_v3:base"), // add missing entry
Defensive patterns

Strategy: validation

Validate before calling

// pre-check the registry before relying on cached snapshots
fn dex_supported_on(chain: Chain, dex: DexType) -> bool {
    crate::exchanges::get_dex_extended(chain, dex).is_some()
}

Try / catch

match load_snapshot(...).await {
    Err(e) if e.to_string().contains("No DEX extended found") => {
        tracing::error!("registry gap for (chain, dex); add DexExtended entry or drop snapshots");
        Err(e)
    }
    other => other,
}

Prevention

When it happens

Trigger: A DEX type is valid in `DexType` but has no registered `DexExtended` for the specific chain — e.g. a DEX not deployed on that chain (Sushi on a chain it doesn't serve), or the chain-specific registry table was not extended when the snapshot was written.

Common situations: New chain support added to DexType but not to the per-chain DexExtended registry; snapshots copied between chain databases; custom integrations missing the registry entry.

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/25286217c034195c. Report an issue: GitHub.