nautechsystems/nautilus_trader · error · anyhow::Error

No RPC URL provided for {}. Set --rpc-url, INFURA_API_KEY, o

Error message

No RPC URL provided for {}. Set --rpc-url, INFURA_API_KEY, or RPC_HTTP_URL

What it means

Thrown by rpc_http_url when no HTTP RPC endpoint can be resolved for the chain from any of three sources: the --rpc-url CLI argument, the Infura provider lookup via INFURA_API_KEY, or the RPC_HTTP_URL environment variable. The client cannot be created without an endpoint.

Source

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

            .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
            )
        })
}

async fn resolve_to_block(data_client: &BlockchainDataClientCore, to_block: Option<u64>) -> u64 {
    match to_block {
        Some(block) => block,
        None => data_client.hypersync_client.current_block().await,
    }
}

fn load_pool_addresses(
    addresses: Vec<String>,
    addresses_file: Option<String>,
) -> anyhow::Result<Vec<String>> {
    let mut pool_addresses = addresses;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Pass --rpc-url <https://...> explicitly on the command line.
  2. Export INFURA_API_KEY so check_infura_rpc_provider can build an Infura URL for the chain.
  3. Set the RPC_HTTP_URL environment variable to an HTTP(S) RPC endpoint for the chain.
  4. If using a private node, confirm the URL is reachable and uses http(s):// scheme.

Example fix

// before
RPC_HTTP_URL= nautilusctl blockchain analyze-pool --chain polygon --dex quickswap
// after
export RPC_HTTP_URL=https://polygon-rpc.com
nautilusctl blockchain analyze-pool --chain polygon --dex quickswap
Defensive patterns

Strategy: validation

Validate before calling

let rpc = rpc_url.clone()
    .or_else(|| std::env::var("INFURA_API_KEY").ok().map(|_| "infura".to_string()))
    .or_else(|| std::env::var("RPC_HTTP_URL").ok());
if rpc.is_none() {
    eprintln!("set --rpc-url, INFURA_API_KEY, or RPC_HTTP_URL for {}", chain.name);
    std::process::exit(2);
}

Prevention

When it happens

Trigger: Calling create_data_client -> rpc_http_url with rpc_url=None while check_infura_rpc_provider returns None and the RPC_HTTP_URL env var is unset.

Common situations: Forgetting --rpc-url on the CLI; INFURA_API_KEY not exported in the shell/CI environment; using a chain not served by the default Infura provider while RPC_HTTP_URL is unset; running in a container without env passthrough.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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