nautechsystems/nautilus_trader · error

{method} returned no result

Error message

{method} returned no result

What it means

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.

Source

Thrown at crates/adapters/blockchain/src/rpc/http.rs:1028

        raw_response.len()
    )
}

/// Classifies a broadcast transport failure: a timeout after sending reconciles through the
/// persisted record. Any other transport failure is treated as ambiguous-after-send too, even
/// though some (for example connection refused) may never have reached the node; the HTTP
/// client does not expose the connect-phase distinction, so the conservative outcome never
/// risks a rebroadcast. Sanitized to never carry the endpoint URL or request payload.
fn classify_broadcast_transport_error(error: &HttpClientError) -> BroadcastError {
    match error {
        HttpClientError::TimeoutError(_) => BroadcastError::TimeoutAfterSend,
        _ => BroadcastError::Failed("transport error".to_string()),
    }
}

/// Parses a required hex-quantity JSON-RPC result, erroring on a missing result.
fn parse_hex_quantity_result(method: &str, result: Option<String>) -> anyhow::Result<u128> {
    let hex_string = result.ok_or_else(|| anyhow::anyhow!("{method} returned no result"))?;
    let stripped = hex_string.strip_prefix("0x").unwrap_or(&hex_string);
    u128::from_str_radix(stripped, 16)
        .map_err(|e| anyhow::anyhow!("Failed to parse {method} result '{hex_string}': {e}"))
}

#[cfg(test)]
pub(crate) mod tests {
    use alloy::primitives::{address, b256};
    use rstest::rstest;

    use super::*;

    #[rstest]
    fn rpc_response_preview_truncates_on_utf8_boundary() {
        let raw = format!("{}é", "a".repeat(499));

        let preview = rpc_response_preview(&raw);

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the raw response (curl eth_chainId) to see whether the node returns null or an actual error.
  2. Use an endpoint that supports the required eth_* namespace (enable it on geth: --http.api eth,net).
  3. Inspect the parsed envelope: if `error` was present the library would have surfaced it; a bare null usually means a proxy/gateway issue.
  4. Try a fallback RPC provider.

Example fix

// before
let provider = HttpRpcClient::new("http://restricted-gateway:8545")?; // eth_maxPriorityFeePerGas not forwarded -> null result
// after
let provider = HttpRpcClient::new("https://full-node:8545")?;
Defensive patterns

Strategy: try-catch

Validate before calling

// Probe the method family before use
let probe = reqwest::Client::new().post(endpoint)
    .json(&serde_json::json!({"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}))
    .send().await?.json::<serde_json::Value>().await?;
if probe.get("result").map(|r| r.is_null()).unwrap_or(true) {
    return Err(anyhow!("node does not return results for required eth_* methods"));
}

Type guard

fn non_null_string_result(v: &serde_json::Value) -> Option<&str> {
    v.get("result").and_then(|r| r.as_str())
}

Try / catch

match client.chain_id() {
    Err(e) if e.to_string().ends_with("returned no result") => {
        tracing::warn!("node returned empty result; switching to fallback RPC");
        fallback.chain_id()
    }
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.

Related errors


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