{"record":{"id":"c53a77e70a6a5a52","repo":"nautechsystems/nautilus_trader","slug":"method-redirect-rejected","errorCode":null,"errorMessage":"{method} redirect rejected","messagePattern":"(.+?) redirect rejected","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/http.rs","lineNumber":331,"sourceCode":"        &self,\n        method: &'static str,\n        params: serde_json::Value,\n    ) -> anyhow::Result<Option<T>> {\n        let request = serde_json::json!({\n            \"jsonrpc\": \"2.0\",\n            \"id\": 1,\n            \"method\": method,\n            \"params\": params,\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!(\"{method} redirect rejected\")\n                }\n                _ => anyhow::anyhow!(\"{method} request failed\"),\n            })?;\n\n        let parsed = serde_json::from_slice::<RpcNodeHttpResponse<T>>(bytes.as_ref())\n            .map_err(|_| anyhow::anyhow!(\"Failed to parse {method} response\"))?;\n\n        if parsed.jsonrpc.is_none()\n            && let (Some(code), Some(_message)) = (parsed.code, parsed.message)\n        {\n            anyhow::bail!(\"{method} RPC error {code}\");\n        }\n\n        if let Some(error) = parsed.error {\n            anyhow::bail!(\"{method} RPC error {}\", error.code);\n        }\n\n        Ok(parsed.result)","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/http.rs#L313-L349","documentation":"This error is raised in `execute_execution_rpc_call` when the underlying HTTP client rejects a redirect response during a JSON-RPC execution-layer request. The lower-level `BlockchainRpcClientError::ClientError` contains \"redirect response rejected\" and is remapped to a clearer message naming the RPC method that was redirected.","triggerScenarios":"Any execution RPC method routed through `execute_execution_rpc_call` (chain_id, get_storage_at, get_code_with_block, get_transaction_count_*) when the configured node URL responds with an HTTP redirect (3xx) instead of a JSON-RPC response.","commonSituations":"Node URL missing a trailing path so the server redirects (e.g. `http://host:8545` redirecting to `http://host:8545/`), load balancer redirecting HTTP to HTTPS, or a wrong port hitting a web server instead of the RPC service.","solutions":["Use the exact RPC endpoint URL that returns JSON-RPC directly (no redirect), e.g. include the full path","Switch `http://` endpoint to `https://` if the server redirects to TLS","Check load balancer/proxy rules for 3xx rewrites on the RPC path","Confirm the port hosts the JSON-RPC service and not a web UI"],"exampleFix":"// before\nlet url = \"http://mainnet-node:8545\";\n// after (server redirects http->https and adds /rpc path)\nlet url = \"https://mainnet-node:8545/rpc\";","handlingStrategy":"validation","validationCode":"// verify the endpoint answers JSON-RPC directly with no redirect\n// curl -sI -X POST $URL -d '{\"jsonrpc\":\"2.0\",\"method\":\"eth_chainId\",\"params\":[],\"id\":1}'\n// assert status is 200, not 3xx","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().ends_with(\"redirect rejected\") => {\n        // fix endpoint URL (final destination, correct scheme/path) before retrying\n    }\n    other => other?,\n}","preventionTips":["Configure the canonical, final URL of the RPC endpoint","Prefer https:// endpoints to avoid scheme-redirects","Verify with curl -I that no 3xx is returned","Document the exact RPC path per environment"],"tags":["rpc","redirect","http","network"],"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"}