{"record":{"id":"62fac52a1e2bd9df","repo":"nautechsystems/nautilus_trader","slug":"debug-tracetransaction-redirect-rejected","errorCode":null,"errorMessage":"debug_traceTransaction redirect rejected","messagePattern":"debug_traceTransaction redirect rejected","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/http.rs","lineNumber":825,"sourceCode":"            \"params\": [\n                B256::ZERO,\n                {\n                    \"tracer\": \"callTracer\",\n                    \"tracerConfig\": {\n                        \"onlyTopCall\": false,\n                        \"withLog\": false,\n                    },\n                }\n            ],\n        });\n        let bytes = self\n            .send_rpc_request(request, Some(EXECUTION_RPC_TIMEOUT_SECS))\n            .await\n            .map_err(|e| match e {\n                BlockchainRpcClientError::ClientError(message)\n                    if message.contains(\"redirect response rejected\") =>\n                {\n                    anyhow::anyhow!(\"debug_traceTransaction redirect rejected\")\n                }\n                _ => anyhow::anyhow!(\"debug_traceTransaction request failed\"),\n            })?;\n        let parsed =\n            serde_json::from_slice::<RpcNodeHttpResponse<serde_json::Value>>(bytes.as_ref())\n                .map_err(|_| anyhow::anyhow!(\"Failed to parse debug_traceTransaction response\"))?;\n        if parsed.jsonrpc.is_none()\n            && let (Some(code), Some(_)) = (parsed.code, parsed.message)\n        {\n            return trace_probe_result(code);\n        }\n\n        if let Some(error) = parsed.error {\n            return trace_probe_result(error.code);\n        }\n        anyhow::ensure!(\n            parsed.result.is_some(),\n            \"debug_traceTransaction returned no result\"","sourceCodeStart":807,"sourceCodeEnd":843,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/http.rs#L807-L843","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: http URL that the gateway redirects to https\nrpc_url = \"http://rpc.provider.example/v3/mykey\"\n// after: use the final https URL directly\nrpc_url = \"https://rpc.provider.example/v3/mykey\"","handlingStrategy":"validation","validationCode":"async fn no_redirect(url: &str) -> bool {\n    reqwest::Client::new().post(url)\n        .json(&serde_json::json!({\"jsonrpc\":\"2.0\",\"method\":\"eth_chainId\",\"params\":[],\"id\":1}))\n        .send().await\n        .map(|r| !r.status().is_redirection())\n        .unwrap_or(false)\n}\n// also: curl -i $URL to inspect 3xx Location headers","typeGuard":null,"tryCatchPattern":"match client.probe_call_trace().await {\n    Ok(()) => Ok(()),\n    Err(e) if e.to_string().contains(\"redirect rejected\") => {\n        Err(anyhow!(\"RPC URL redirects; use the final https URL directly: {e}\"))\n    }\n    Err(e) => Err(e),\n}","preventionTips":["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"],"tags":["rpc","http","redirect","tracing"],"backgroundTag":"invalid-url","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"}