nautechsystems/nautilus_trader · error
Invalid chain '{chain_name}' in venue '{venue_str}'
Error message
Invalid chain '{chain_name}' in venue '{venue_str}' What it means
Venue::parse_dex expects a DEX venue string in 'Chain:DexId' format and validates the chain part against known chains via Chain::from_chain_name. If the text before the colon is not a recognized chain name, this error is raised.
Source
Thrown at crates/model/src/identifiers/venue.rs:156
}
#[cfg(feature = "defi")]
/// 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)
}View on GitHub (pinned to 18893faf8b)
Solutions
- Use the exact canonical chain name recognized by Chain::from_chain_name (check casing, e.g. 'Ethereum', 'Solana', 'Arbitrum').
- Verify the chain is registered/compiled into the build; register or add the chain if it is a supported-but-missing one.
- Log/inspect the full venue string to confirm the prefix before the ':' is the chain and the suffix is the DEX.
Example fix
// before
let (chain, dex) = Venue::from("ETHEREUM:uniswap").parse_dex()?;
// after
let (chain, dex) = Venue::from("Ethereum:uniswap").parse_dex()?; Defensive patterns
Strategy: validation
Validate before calling
let (chain_name, _) = venue_str.split_once(':')?;
if Chain::from_chain_name(chain_name).is_none() {
return Err(format!("unknown chain {chain_name}"));
} Try / catch
// Rust let (chain, dex) = venue.parse_dex().map_err(|e| ConfigError::BadDexVenue(e.to_string()))?;
Prevention
- Validate 'Chain:DexId' venue strings at config load time, not at trade time
- Use canonical chain names matching Chain::from_chain_name
- Enumerate supported chains in startup checks
When it happens
Trigger: Calling parse_dex on a venue whose prefix is not a registered chain name, e.g. "ETHEREUM:uniswap" when the chain registry uses "Ethereum", or a completely unknown chain like "SOLANAMAINNET:raydium".
Common situations: Configuring a DeFi venue by hand with wrong casing for the chain, using a chain the installation does not know, or forgetting that parse_dex only accepts venues that actually contain a ':' separator (well-formed DEX strings but bogus chain names).
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- Invalid DEX '{dex_id}' in venue '{venue_str}'
- Unknown DEX {dex_id} on chain {}
- Dex {dex_id} doesn't exist for chain {}
- Unknown venue code: {code}
- Invalid venue {}, expected Blockchain DEX format
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/601e13f9ab6f6ad3.
Report an issue: GitHub.