nautechsystems/nautilus_trader · error

Invalid DEX '{dex_id}' in venue '{venue_str}'

Error message

Invalid DEX '{dex_id}' in venue '{venue_str}'

What it means

A parse-time validation error in parse_dex: the venue string contained a colon but the portion after it ('dex_id') is not a recognized DEX type name (expected format 'Chain:DexId'). The input at fault is a Venue string whose DEX segment does not match any known DexType.

Source

Thrown at crates/model/src/identifiers/venue.rs:159

    /// Parses a venue string to extract blockchain and DEX type information.
    ///
    /// # Errors
    ///
    /// Returns an error if:
    /// - The venue string is not in the format "chain:dex"
    /// - The chain name is not recognized
    /// - The DEX name is not recognized
    pub fn parse_dex(&self) -> anyhow::Result<(Blockchain, DexType)> {
        let venue_str = self.as_str();
        let Some((chain_name, dex_id)) = venue_str.split_once(':') else {
            anyhow::bail!("Venue '{venue_str}' is not a DEX venue (expected format 'Chain:DexId')")
        };

        let chain = Chain::from_chain_name(chain_name).ok_or_else(|| {
            anyhow::anyhow!("Invalid chain '{chain_name}' in venue '{venue_str}'")
        })?;
        let dex_type = DexType::from_dex_name(dex_id)
            .ok_or_else(|| anyhow::anyhow!("Invalid DEX '{dex_id}' in venue '{venue_str}'"))?;

        Ok((chain.name, dex_type))
    }
}

impl Debug for Venue {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "\"{}\"", self.0)
    }
}

impl Display for Venue {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

/// Validates blockchain venue format "Chain:DexId".

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use the exact registered DEX name accepted by DexType::from_dex_name (check spelling and casing).
  2. Confirm the DEX type exists in the build/registry; enable or register the corresponding DEX support if needed.
  3. Split the venue string on ':' and validate both halves independently to identify which part is wrong.

Example fix

// before
let (chain, dex) = Venue::from("Solana:uniswap").parse_dex()?;
// after
let (chain, dex) = Venue::from("Solana:raydium").parse_dex()?;
Defensive patterns

Strategy: validation

Validate before calling

let (_, dex_id) = venue_str.split_once(':')?;
if DexType::from_dex_name(dex_id).is_none() {
    return Err(format!("unknown DEX {dex_id}"));
}

Try / catch

// Rust
let (chain, dex) = venue.parse_dex().map_err(|e| ConfigError::BadDexVenue(e.to_string()))?;

Prevention

When it happens

Trigger: Calling parse_dex with a venue whose DEX id is unknown, e.g. "Ethereum:pancakeswap" on a build that only knows Ethereum DEXs, misspellings like "Ethereum:UniswapV3" when the registered name is different.

Common situations: Hand-written venue config for a DEX the installation does not support, wrong casing/abbreviation of the DEX name, or mixing chain/DEX pairs that are not registered together.

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


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