nautechsystems/nautilus_trader · error
debug_traceTransaction redirect rejected
Error message
debug_traceTransaction redirect rejected
What it means
`probe_call_trace` sends a test `debug_traceTransaction` request to check whether the endpoint accepts the configured `callTracer` request shape. When the underlying transport reports a client error containing "redirect response rejected", it is re-mapped to this specific error, distinguishing redirect rejection from other request failures.
Source
Thrown at crates/adapters/blockchain/src/rpc/http.rs:825
"params": [
B256::ZERO,
{
"tracer": "callTracer",
"tracerConfig": {
"onlyTopCall": false,
"withLog": false,
},
}
],
});
let bytes = self
.send_rpc_request(request, Some(EXECUTION_RPC_TIMEOUT_SECS))
.await
.map_err(|e| match e {
BlockchainRpcClientError::ClientError(message)
if message.contains("redirect response rejected") =>
{
anyhow::anyhow!("debug_traceTransaction redirect rejected")
}
_ => anyhow::anyhow!("debug_traceTransaction request failed"),
})?;
let parsed =
serde_json::from_slice::<RpcNodeHttpResponse<serde_json::Value>>(bytes.as_ref())
.map_err(|_| anyhow::anyhow!("Failed to parse debug_traceTransaction response"))?;
if parsed.jsonrpc.is_none()
&& let (Some(code), Some(_)) = (parsed.code, parsed.message)
{
return trace_probe_result(code);
}
if let Some(error) = parsed.error {
return trace_probe_result(error.code);
}
anyhow::ensure!(
parsed.result.is_some(),
"debug_traceTransaction returned no result"View on GitHub (pinned to 18893faf8b)
Solutions
- Change the RPC URL to the final destination (usually https:// and the exact path) so no redirect occurs
- Check whether a missing/expired API key causes the provider to redirect; add credentials to the URL/config
- Test with `curl -i` on the configured URL to see the 3xx and its Location header
- Remove trailing slashes or wrong paths that trigger canonical redirects
Example fix
// before: http URL that the gateway redirects to https rpc_url = "http://rpc.provider.example/v3/mykey" // after: use the final https URL directly rpc_url = "https://rpc.provider.example/v3/mykey"
Defensive patterns
Strategy: validation
Validate before calling
async fn no_redirect(url: &str) -> bool {
reqwest::Client::new().post(url)
.json(&serde_json::json!({"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}))
.send().await
.map(|r| !r.status().is_redirection())
.unwrap_or(false)
}
// also: curl -i $URL to inspect 3xx Location headers Try / catch
match client.probe_call_trace().await {
Ok(()) => Ok(()),
Err(e) if e.to_string().contains("redirect rejected") => {
Err(anyhow!("RPC URL redirects; use the final https URL directly: {e}"))
}
Err(e) => Err(e),
} Prevention
- Configure the final https:// URL and exact path so the server never issues a 3xx
- Remove trailing slashes or wrong paths that trigger canonical redirects
- Provide valid API keys so providers have no reason to redirect to auth pages
- Probe the endpoint with curl -i at startup to catch redirects early
When it happens
Trigger: The HTTP client receives a redirect (3xx) from the RPC endpoint and refuses to follow it — typically the endpoint URL is behind a redirecting proxy, points at http:// when the server redirects to https://, or the provider redirects unauthenticated requests to a login/canonical URL.
Common situations: Configuring `http://host:8545` while the provider redirects to `https://`; trailing-slash or path redirects from a gateway; providers redirecting to an auth page when the API key is missing.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- {method} redirect rejected
- eth_call redirect rejected
- debug_traceTransaction RPC error {code}
- Failed to execute eth call RPC request: {e}
- Failed to parse eth call response: {e} Raw response: {previe
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/62fac52a1e2bd9df.
Report an issue: GitHub.