{"record":{"id":"26ff1dc82cd24d50","repo":"nautechsystems/nautilus_trader","slug":"rpc-block-feed-selected-without-an-rpc-client","errorCode":null,"errorMessage":"RPC block feed selected without an RPC client","messagePattern":"RPC block feed selected without an RPC client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/data/client.rs","lineNumber":1058,"sourceCode":"        core_client: &mut BlockchainDataClientCore,\n        owner: BlockFeedOwner,\n    ) -> anyhow::Result<()> {\n        let preferred_backend = if core_client.rpc_client.is_some() {\n            BlockFeedBackend::Rpc\n        } else {\n            BlockFeedBackend::HyperSync\n        };\n        let Some(backend) = core_client\n            .subscription_manager\n            .add_block_demand(owner, preferred_backend)\n        else {\n            return Ok(());\n        };\n\n        let started_backend = match backend {\n            BlockFeedBackend::Rpc => {\n                let Some(rpc) = core_client.rpc_client.as_mut() else {\n                    anyhow::bail!(\"RPC block feed selected without an RPC client\")\n                };\n\n                match rpc.subscribe_blocks().await {\n                    Ok(()) => {\n                        log::debug!(\"Successfully subscribed to blocks via RPC\");\n                        BlockFeedBackend::Rpc\n                    }\n                    Err(e) if owner == BlockFeedOwner::Explicit => {\n                        log::warn!(\n                            \"RPC blocks subscription failed: {e}, falling back to HyperSync\"\n                        );\n                        core_client.hypersync_client.subscribe_blocks();\n                        tokio::task::yield_now().await;\n                        BlockFeedBackend::HyperSync\n                    }\n                    Err(e) => return Err(e.into()),\n                }\n            }","sourceCodeStart":1040,"sourceCodeEnd":1076,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/data/client.rs#L1040-L1076","documentation":"subscribe_block_feed resolved the configured backend to BlockFeedBackend::Rpc, but the core client has no RPC client configured (rpc_client is None). The RPC block feed cannot run without an HTTP/WS RPC connection, so the call fails fast.","triggerScenarios":"Calling subscribe_block_feed (or triggering block feed subscription via handle_subscribe_command) when block-feed backend is configured to Rpc but rpc_client was never constructed — e.g. missing RPC URL in config, or the client was built in HyperSync-only mode.","commonSituations":"Config omits the RPC endpoint/WS URL; environment variable for RPC URL unset; user intended HyperSync backend but selected Rpc; RPC client failed to initialize earlier and was left as None.","solutions":["Provide an RPC (WS) URL in the blockchain adapter config so rpc_client is initialized","Or select the HyperSync block feed backend instead","Check that rpc_client construction did not silently fail during client build"],"exampleFix":"// before\n# config: block_feed_backend = \"rpc\"  (no rpc_url set)\n// after\n[rpc]\nurl = \"wss://base-mainnet.g.alchemy.com/v2/<key>\"\nblock_feed_backend = \"rpc\"","handlingStrategy":"validation","validationCode":"if backend == BlockFeedBackend::Rpc && client.rpc_client().is_none() {\n    return Err(anyhow::anyhow!(\"configure an RPC URL before selecting the rpc block feed\"));\n}","typeGuard":null,"tryCatchPattern":"match client.subscribe_block_feed().await {\n    Err(e) if e.to_string().contains(\"without an RPC client\") => {\n        log::error!(\"RPC URL not configured; enable rpc or use hypersync backend\");\n    }\n    r => r?,\n}","preventionTips":["Validate backend + rpc_url pairing at startup config parsing","Prefer defaulting to HyperSync when no RPC URL is set","Add a health check that rpc_client is Some before subscribing"],"tags":["rpc","configuration","block-feed","missing-client"],"backgroundTag":"missing-required-config-field","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}