nautechsystems/nautilus_trader · error · anyhow::Error
No RPC URL provided for {name}. Set --rpc-url, INFURA_API_KE
Error message
No RPC URL provided for {name}. Set --rpc-url, INFURA_API_KEY, or RPC_HTTP_URL What it means
Thrown by run_sync_dex when no HTTP RPC endpoint can be resolved for the chain from the --rpc-url argument, the Infura provider via INFURA_API_KEY, or the RPC_HTTP_URL environment variable. Syncing requires an RPC endpoint to read PoolCreated logs and cannot start without one.
Source
Thrown at crates/cli/src/blockchain/sync.rs:78
anyhow::bail!(
"DEX '{dex_type}' on chain '{}' cannot be synced: missing a PoolCreated parser for pool discovery.",
chain.name
);
}
let postgres_connect_options = get_postgres_connect_options(
database.host,
database.port,
database.username,
database.password,
database.database,
);
// Get RPC HTTP URL: CLI arg, Infura provider, OR RPC_HTTP_URL env var
let rpc_http_url = 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 {name}. Set --rpc-url, INFURA_API_KEY, or RPC_HTTP_URL",
name = chain.name
)
})?;
// Mask potential API key in URL for logging (key is typically the last path segment)
let masked_url = if let Some((base, key)) = rpc_http_url.rsplit_once('/') {
if key.is_empty() {
rpc_http_url.clone()
} else {
let masked_key = mask_api_key(key);
format!("{base}/{masked_key}")
}
} else {
// URL without path separator - mask entirely as it may contain credentials
mask_api_key(&rpc_http_url)
};
View on GitHub (pinned to 18893faf8b)
Solutions
- Pass --rpc-url <https://...> explicitly for the chain.
- Export INFURA_API_KEY so the Infura provider lookup succeeds.
- Set RPC_HTTP_URL to a reachable HTTP(S) RPC endpoint.
- For systemd/docker, ensure the env var is passed into the service environment.
Example fix
// before nautilusctl blockchain sync-dex --chain base --dex aerodrome // error: no RPC URL // after nautilusctl blockchain sync-dex --chain base --dex aerodrome --rpc-url https://mainnet.base.org
Defensive patterns
Strategy: validation
Validate before calling
let has_rpc = rpc_url.is_some()
|| std::env::var("INFURA_API_KEY").is_ok()
|| std::env::var("RPC_HTTP_URL").is_ok();
if !has_rpc {
eprintln!("provide --rpc-url, INFURA_API_KEY, or RPC_HTTP_URL for {}", chain.name);
std::process::exit(2);
} Prevention
- Prefer explicit --rpc-url in automation over env-dependent resolution.
- Verify INFURA_API_KEY is set in every environment (CI secrets, cron, containers).
- Keep RPC_HTTP_URL in a loaded .env for local development.
- Check env propagation for sudo/docker/systemd which can strip environment variables.
When it happens
Trigger: run_blockchain_command -> run_sync_dex with rpc_url=None while check_infura_rpc_provider(chain.name) returns None and std::env::var("RPC_HTTP_URL") is unset or errors.
Common situations: Missing --rpc-url flag; INFURA_API_KEY not set in the environment (CI, containers, cron); chain not covered by the Infura provider mapping; RPC_HTTP_URL defined in a shell profile not loaded by the service manager.
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
- No RPC URL provided for {}. Set --rpc-url, INFURA_API_KEY, o
- Failed to register DEX exchange: {e}
- Failed to sync pools: {e}
- Failed to sync blocks: {e}
- Unsupported blockchain {blockchain} for RPC connection
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/f62da331fab86792.
Report an issue: GitHub.