{"record":{"id":"04670d16e4e5d340","repo":"nautechsystems/nautilus_trader","slug":"method-returned-no-result","errorCode":null,"errorMessage":"{method} returned no result","messagePattern":"(.+?) returned no result","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/http.rs","lineNumber":1028,"sourceCode":"        raw_response.len()\n    )\n}\n\n/// Classifies a broadcast transport failure: a timeout after sending reconciles through the\n/// persisted record. Any other transport failure is treated as ambiguous-after-send too, even\n/// though some (for example connection refused) may never have reached the node; the HTTP\n/// client does not expose the connect-phase distinction, so the conservative outcome never\n/// risks a rebroadcast. Sanitized to never carry the endpoint URL or request payload.\nfn classify_broadcast_transport_error(error: &HttpClientError) -> BroadcastError {\n    match error {\n        HttpClientError::TimeoutError(_) => BroadcastError::TimeoutAfterSend,\n        _ => BroadcastError::Failed(\"transport error\".to_string()),\n    }\n}\n\n/// Parses a required hex-quantity JSON-RPC result, erroring on a missing result.\nfn parse_hex_quantity_result(method: &str, result: Option<String>) -> anyhow::Result<u128> {\n    let hex_string = result.ok_or_else(|| anyhow::anyhow!(\"{method} returned no result\"))?;\n    let stripped = hex_string.strip_prefix(\"0x\").unwrap_or(&hex_string);\n    u128::from_str_radix(stripped, 16)\n        .map_err(|e| anyhow::anyhow!(\"Failed to parse {method} result '{hex_string}': {e}\"))\n}\n\n#[cfg(test)]\npub(crate) mod tests {\n    use alloy::primitives::{address, b256};\n    use rstest::rstest;\n\n    use super::*;\n\n    #[rstest]\n    fn rpc_response_preview_truncates_on_utf8_boundary() {\n        let raw = format!(\"{}é\", \"a\".repeat(499));\n\n        let preview = rpc_response_preview(&raw);\n","sourceCodeStart":1010,"sourceCodeEnd":1046,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/http.rs#L1010-L1046","documentation":"Thrown by `parse_hex_quantity_result` when a JSON-RPC method expected to return a hex-quantity (eth_chainId, eth_getTransactionCount, eth_estimateGas, eth_maxPriorityFeePerGas) responds without a `result` field. The helper treats a missing result as a hard error since every caller needs a numeric value.","triggerScenarios":"Calling `chain_id`, `get_transaction_count_*`, `estimate_gas_with_block`, or `max_priority_fee_per_gas` against a node that answers with `result: null`/missing — e.g. unsupported method, node erroring softly, or a proxy swallowing the request — after the response parsed with no `error` field.","commonSituations":"Node that doesn't implement the method (restricted API namespaces); LB/proxy returning an empty JSON-RPC envelope; provider plan that excludes the requested method.","solutions":["Check the raw response (curl eth_chainId) to see whether the node returns null or an actual error.","Use an endpoint that supports the required eth_* namespace (enable it on geth: --http.api eth,net).","Inspect the parsed envelope: if `error` was present the library would have surfaced it; a bare null usually means a proxy/gateway issue.","Try a fallback RPC provider."],"exampleFix":"// before\nlet provider = HttpRpcClient::new(\"http://restricted-gateway:8545\")?; // eth_maxPriorityFeePerGas not forwarded -> null result\n// after\nlet provider = HttpRpcClient::new(\"https://full-node:8545\")?;","handlingStrategy":"try-catch","validationCode":"// Probe the method family before use\nlet probe = reqwest::Client::new().post(endpoint)\n    .json(&serde_json::json!({\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_chainId\",\"params\":[]}))\n    .send().await?.json::<serde_json::Value>().await?;\nif probe.get(\"result\").map(|r| r.is_null()).unwrap_or(true) {\n    return Err(anyhow!(\"node does not return results for required eth_* methods\"));\n}","typeGuard":"fn non_null_string_result(v: &serde_json::Value) -> Option<&str> {\n    v.get(\"result\").and_then(|r| r.as_str())\n}","tryCatchPattern":"match client.chain_id() {\n    Err(e) if e.to_string().ends_with(\"returned no result\") => {\n        tracing::warn!(\"node returned empty result; switching to fallback RPC\");\n        fallback.chain_id()\n    }\n    other => other,\n}","preventionTips":["Verify the endpoint exposes the needed eth_* methods (curl eth_chainId) before configuring it.","Watch for proxies/gateways that return empty JSON-RPC envelopes and alert on them.","Maintain a fallback RPC endpoint for methods the primary node restricts."],"tags":["rpc","json","empty-response"],"backgroundTag":"empty-api-response","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}