nautechsystems/nautilus_trader · error
RPC parsing of collect event is not defined in this dex: {}:
Error message
RPC parsing of collect event is not defined in this dex: {}:{} What it means
Raised by `DexExtended::parse_collect_event_rpc` when the DEX has no RPC collect-event parser registered (`parse_collect_event_rpc_fn` is `None`). Collect events (position fee collection in V3-style DEXes) must be opted into per adapter; this DEX does not provide an RPC log parser for them, so the call bails with the chain and DEX name.
Source
Thrown at crates/adapters/blockchain/src/exchanges/extended.rs:526
} else {
anyhow::bail!(
"RPC parsing of initialize event is not defined in this dex: {}:{}",
self.dex.chain,
self.dex.name
)
}
}
/// Parses a collect event from an RPC log.
///
/// # Errors
///
/// Returns an error if the DEX does not have an RPC collect event parser defined or if parsing fails.
pub fn parse_collect_event_rpc(&self, log: &RpcLog) -> anyhow::Result<CollectEvent> {
if let Some(parse_fn) = &self.parse_collect_event_rpc_fn {
parse_fn(self.dex.clone(), log)
} 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: {}:{}",View on GitHub (pinned to 18893faf8b)
Solutions
- Register the collect RPC parser on the DEX at construction time (`parse_collect_event_rpc_fn: Some(...)`).
- Guard the call: only invoke `parse_collect_event_rpc` when the parser fn is present; otherwise skip the log and record the DEX/chain.
- Filter Collect topic0 out of your RPC log subscription for this DEX if collect data is not required.
- Check the adapter's registered parser list (or tests like the ones calling these parse functions) to confirm which events that DEX supports.
Example fix
// before
let ev = dex.parse_collect_event_rpc(&log)?;
// after
match dex.parse_collect_event_rpc(&log) {
Ok(ev) => handle(ev),
Err(e) if e.to_string().contains("not defined in this dex") => tracing::debug!("collect rpc parser unsupported for {}:{}", dex.dex.chain, dex.dex.name),
Err(e) => return Err(e),
} Defensive patterns
Strategy: fallback
Validate before calling
if dex.parse_collect_event_rpc_fn.is_none() {
tracing::debug!("collect rpc parsing unsupported for {}:{}", dex.dex.chain, dex.dex.name);
return Ok(());
} Type guard
fn supports_collect_rpc(dex: &DexExtended) -> bool {
dex.parse_collect_event_rpc_fn.is_some()
} Try / catch
match dex.parse_collect_event_rpc(&log) {
Ok(ev) => handle_collect(ev),
Err(e) if e.to_string().contains("not defined in this dex") => Ok(()),
Err(e) => Err(e),
} Prevention
- Wire the collect RPC parser in every DEX constructor variant you build.
- Filter Collect topic0 out of RPC subscriptions for DEXes without the parser.
- Treat 'not defined in this dex' as a skip, not a hard failure, in batch ingestion.
- Diff your log topic list against the parsers registered per DEX during boot.
When it happens
Trigger: Calling `dex.parse_collect_event_rpc(&log)` on a `DexExtended` constructed without `parse_collect_event_rpc_fn` set — e.g. routing Collect logs from an RPC subscription to a DEX adapter that never registered a collect RPC parser.
Common situations: Replaying historical Collect logs via eth_getLogs/subscription for a DEX whose adapter only wires Hypersync parsing; copying a DEX setup from a minimal example that omits the collect parser; new chain support added before all event parsers were wired.
Related errors
- RPC parsing of initialize event is not defined in this dex:
- RPC parsing of flash 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/7c0e0330f79254e4.
Report an issue: GitHub.