nautechsystems/nautilus_trader · error · anyhow::Error

DEX '{dex_type}' on chain '{}' cannot be analyzed: missing p

Error message

DEX '{dex_type}' on chain '{}' cannot be analyzed: missing pool-event parser(s) for {families}. Pool analysis needs Initialize, Swap, Mint, Burn, and Collect parsers.

What it means

Pool analysis requires event parsers for all five pool-event families: Initialize, Swap, Mint, Burn, and Collect. ensure_pool_analysis_supported checks the registry for the given DEX type on the chain and bails listing exactly which families are missing, because analysis would produce incomplete/incorrect results without them.

Source

Thrown at crates/cli/src/blockchain/analyze.rs:545

// A DEX can be registered for discovery yet lack the analysis parsers; fail here instead of
// syncing and only failing deep inside profiling.
fn ensure_pool_analysis_supported(chain: &Chain, dex_type: DexType) -> anyhow::Result<()> {
    let dex_extended = get_dex_extended(chain.name, &dex_type).ok_or_else(|| {
        anyhow::anyhow!(
            "DEX '{dex_type}' is not registered on chain '{}'",
            chain.name
        )
    })?;

    let missing = dex_extended.missing_pool_analysis_parsers();
    if !missing.is_empty() {
        let families = missing
            .iter()
            .map(ToString::to_string)
            .collect::<Vec<_>>()
            .join(", ");
        anyhow::bail!(
            "DEX '{dex_type}' on chain '{}' cannot be analyzed: missing pool-event parser(s) for {families}. \
             Pool analysis needs Initialize, Swap, Mint, Burn, and Collect parsers.",
            chain.name
        );
    }

    Ok(())
}

fn rpc_http_url(chain: &Chain, rpc_url: Option<String>) -> anyhow::Result<String> {
    rpc_url
        .or_else(|| check_infura_rpc_provider(&chain.name))
        .or_else(|| std::env::var("RPC_HTTP_URL").ok())
        .ok_or_else(|| {
            anyhow::anyhow!(
                "No RPC URL provided for {}. Set --rpc-url, INFURA_API_KEY, or RPC_HTTP_URL",
                chain.name
            )

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Register the missing event parser family/families for the DEX on that chain before analysis (names are listed in the error)
  2. Use a DEX type that has full parser coverage for the target chain
  3. If you do not need full event coverage, use a lighter analysis command instead of pool analysis
  4. Upgrade the CLI/adapter package — newer versions may ship the missing parsers

Example fix

// before
// registry: only Initialize + Swap parsers for dex_type "mydex"
analyze --dex-type mydex ...
// after
registry.register("mydex", chain, MintParser::new(...));
registry.register("mydex", chain, BurnParser::new(...));
registry.register("mydex", chain, CollectParser::new(...));
Defensive patterns

Strategy: validation

Validate before calling

REQUIRED_FAMILIES = {"Initialize", "Swap", "Mint", "Burn", "Collect"}
def check_dex_parsers(dex_type, chain, registry):
    have = registry.registered_event_families(dex_type, chain)
    missing = REQUIRED_FAMILIES - have
    if missing:
        raise ValueError(f"{dex_type} on {chain}: missing parsers {sorted(missing)}")

Try / catch

try:
    ensure_pool_analysis_supported(dex_type, chain)
except ValueError as e:
    print(e)  # lists exact missing parser families

Prevention

When it happens

Trigger: Calling ensure_pool_analysis_supported (via parse_chain_dex) with a DEX type whose parser registrations on that chain are incomplete — e.g. a custom DEX registered with only Swap and Initialize parsers.

Common situations: Using a newly added or custom DEX adapter before all parsers are registered; a chain where the DEX's Collect/Mint events are not yet implemented; typo in --dex-type selecting the wrong DEX entry.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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