nautechsystems/nautilus_trader · error
RPC parsing of flash event is not defined in this dex: {}:{}
Error message
RPC parsing of flash event is not defined in this dex: {}:{} What it means
Raised by `DexExtended::parse_flash_event_rpc` when the DEX has no RPC flash-event parser registered (`parse_flash_event_rpc_fn` is `None`). Flash-loan callback events must be explicitly supported by each DEX adapter; when the optional parser function is unset, the method bails naming the chain and DEX.
Source
Thrown at crates/adapters/blockchain/src/exchanges/extended.rs:543
} else {
anyhow::bail!(
"RPC parsing of collect event is not defined in this dex: {}:{}",
self.dex.chain,
self.dex.name
)
}
}
/// Parses a flash event from an RPC log.
///
/// # Errors
///
/// Returns an error if the DEX does not have an RPC flash event parser defined or if parsing fails.
pub fn parse_flash_event_rpc(&self, log: &RpcLog) -> anyhow::Result<FlashEvent> {
if let Some(parse_fn) = &self.parse_flash_event_rpc_fn {
parse_fn(self.dex.clone(), log)
} else {
anyhow::bail!(
"RPC parsing of flash event is not defined in this dex: {}:{}",
self.dex.chain,
self.dex.name
)
}
}
/// Parses a `SetFeeProtocol` event from an RPC log.
///
/// # Errors
///
/// Returns an error if the DEX does not have an RPC `SetFeeProtocol` event parser defined or if parsing fails.
pub fn parse_fee_protocol_update_event_rpc(
&self,
log: &RpcLog,
) -> anyhow::Result<FeeProtocolUpdateEvent> {
if let Some(parse_fn) = &self.parse_fee_protocol_update_event_rpc_fn {
parse_fn(self.dex.clone(), log)View on GitHub (pinned to 18893faf8b)
Solutions
- Set `parse_flash_event_rpc_fn: Some(...)` when constructing the `DexExtended` for DEXes whose contracts emit Flash events.
- Before calling, check `parse_flash_event_rpc_fn.is_some()` (or a capability method) and skip unsupported DEXes.
- Exclude Flash topic0 from the RPC log filter for this DEX if flash events are irrelevant to your use case.
- Align your subscription topics with the adapter's supported events instead of subscribing to all pool events.
Example fix
// before
let ev = dex.parse_flash_event_rpc(&log)?; // panics out via bail on most DEXes
// after
if dex.parse_flash_event_rpc_fn.is_some() {
let ev = dex.parse_flash_event_rpc(&log)?;
} else {
tracing::debug!("flash rpc parsing unsupported: {}:{}", dex.dex.chain, dex.dex.name);
} Defensive patterns
Strategy: fallback
Validate before calling
if dex.parse_flash_event_rpc_fn.is_none() {
tracing::debug!("flash rpc parsing unsupported");
return Ok(());
} Type guard
fn supports_flash_rpc(dex: &DexExtended) -> bool {
dex.parse_flash_event_rpc_fn.is_some()
} Try / catch
match dex.parse_flash_event_rpc(&log) {
Ok(ev) => handle_flash(ev),
Err(e) if e.to_string().contains("not defined in this dex") => Ok(()),
Err(e) => Err(e),
} Prevention
- Register the flash RPC parser for every DEX whose pools emit Flash events.
- Only subscribe to Flash topic0 for DEXes known to support it.
- Fail fast at startup if a DEX marked flash-capable lacks the parser fn.
- Verify adapter coverage after adding a new chain/DEX to your config.
When it happens
Trigger: Calling `dex.parse_flash_event_rpc(&log)` on a `DexExtended` built without `parse_flash_event_rpc_fn` — e.g. feeding Flash event logs from an RPC provider into an adapter that only registered swap/mint/burn RPC parsers.
Common situations: Indexing flash-loan activity across many DEXes where only some adapters implement Flash parsing; a fork of an adapter (e.g. PancakeSwap V3) that dropped the flash parser; mismatch between the log topics you subscribe to and the parsers the adapter defines.
Related errors
- RPC parsing of initialize event is not defined in this dex:
- RPC parsing of collect event is not defined in this dex: {}:
- RPC parsing of SetFeeProtocol event is not defined in this d
- RPC parsing of CollectProtocol event is not defined in this
- RPC parsing of pool created event is not defined in this dex
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/5197e7ca237a855a.
Report an issue: GitHub.