nautechsystems/nautilus_trader · error
RPC parsing of CollectProtocol event is not defined in this
Error message
RPC parsing of CollectProtocol event is not defined in this dex: {}:{} What it means
Raised by `DexExtended::parse_fee_protocol_collect_event_rpc` when the DEX has no RPC parser registered for the CollectProtocol event (`parse_fee_protocol_collect_event_rpc_fn` is `None`). Protocol-fee collection events are specific to certain V3-fork DEXes; adapters that don't implement an RPC log parser for them bail with the chain and DEX name so callers know the capability gap.
Source
Thrown at crates/adapters/blockchain/src/exchanges/extended.rs:583
self.dex.chain,
self.dex.name
)
}
}
/// Parses a `CollectProtocol` event from an RPC log.
///
/// # Errors
///
/// Returns an error if the DEX does not have an RPC `CollectProtocol` event parser defined or if parsing fails.
pub fn parse_fee_protocol_collect_event_rpc(
&self,
log: &RpcLog,
) -> anyhow::Result<FeeProtocolCollectEvent> {
if let Some(parse_fn) = &self.parse_fee_protocol_collect_event_rpc_fn {
parse_fn(self.dex.clone(), log)
} else {
anyhow::bail!(
"RPC parsing of CollectProtocol event is not defined in this dex: {}:{}",
self.dex.chain,
self.dex.name
)
}
}
/// Checks if this DEX requires pool initialization events.
#[must_use]
pub fn needs_initialization(&self) -> bool {
self.dex.initialize_event.is_some()
}
/// Returns `true` if this DEX can discover pools from HyperSync `PoolCreated` logs.
///
/// `sync-dex` streams `PoolCreated` logs to populate the pool set, so a DEX without this
/// parser cannot be synced.
#[must_use]View on GitHub (pinned to 18893faf8b)
Solutions
- Register the parser: `parse_fee_protocol_collect_event_rpc_fn: Some(parsing::pancakeswap_v3::fee_protocol_update::parse_fee_protocol_collect_event_rpc)` at DEX construction.
- Gate the call on `parse_fee_protocol_collect_event_rpc_fn.is_some()` and skip/log unsupported DEXes.
- Filter CollectProtocol topic0 from your log stream for DEXes without support.
- Audit the full set of optional parser fns (`parse_*_rpc_fn`) during startup and fail fast if any required ones are missing for your chains.
Example fix
// before
let ev = dex.parse_fee_protocol_collect_event_rpc(&log)?;
// after
let ev = match dex.parse_fee_protocol_collect_event_rpc(&log) {
Ok(ev) => Some(ev),
Err(e) if e.to_string().contains("not defined in this dex") => None,
Err(e) => return Err(e),
}; Defensive patterns
Strategy: validation
Validate before calling
if dex.parse_fee_protocol_collect_event_rpc_fn.is_none()
|| log.topics.first().map(String::as_str) != Some(COLLECT_PROTOCOL_TOPIC)
{
return Ok(()); // skip unsupported
} Type guard
fn supports_fee_protocol_collect_rpc(dex: &DexExtended) -> bool {
dex.parse_fee_protocol_collect_event_rpc_fn.is_some()
} Try / catch
match dex.parse_fee_protocol_collect_event_rpc(&log) {
Ok(ev) => handle(ev),
Err(e) if e.to_string().contains("not defined in this dex") => Ok(()),
Err(e) => Err(e),
} Prevention
- Register both fee-protocol parsers (update and collect) together so one is never missing.
- Audit all optional parser fns on each DexExtended at construction time.
- Filter CollectProtocol topic0 out of streams for DEXes without support.
- When forking an adapter, copy the complete parser registry, not a subset.
When it happens
Trigger: Calling `dex.parse_fee_protocol_collect_event_rpc(&log)` on a `DexExtended` constructed without `parse_fee_protocol_collect_event_rpc_fn` — typically when dispatching CollectProtocol logs from an RPC source to an adapter that only registered other event parsers.
Common situations: Indexing protocol-fee revenue across multiple V3-fork DEXes where only some adapters implement CollectProtocol parsing; an adapter version that predates fee-protocol support; wiring the update parser but forgetting the collect parser.
Related errors
- RPC parsing of SetFeeProtocol event is not defined in this d
- 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 flash event is not defined in this dex: {}:{}
- 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/646707059ff764a1.
Report an issue: GitHub.