{"record":{"id":"0b6964b4ebf2c09f","repo":"nautechsystems/nautilus_trader","slug":"broadcast-response-does-not-contain-tx-response","errorCode":null,"errorMessage":"Broadcast response does not contain tx_response","messagePattern":"Broadcast response does not contain tx_response","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/dydx/src/grpc/client.rs","lineNumber":496,"sourceCode":"    /// Returns an error if broadcasting fails.\n    pub async fn broadcast_tx(&mut self, tx_bytes: Vec<u8>) -> Result<TxHash, anyhow::Error> {\n        let req = BroadcastTxRequest {\n            tx_bytes,\n            mode: BroadcastMode::Sync as i32,\n        };\n        let response = self.tx.broadcast_tx(req).await?.into_inner();\n\n        if let Some(tx_response) = response.tx_response {\n            if tx_response.code != 0 {\n                anyhow::bail!(\n                    \"Transaction broadcast failed: code={}, log={}\",\n                    tx_response.code,\n                    tx_response.raw_log\n                );\n            }\n            Ok(tx_response.txhash)\n        } else {\n            Err(anyhow::anyhow!(\n                \"Broadcast response does not contain tx_response\"\n            ))\n        }\n    }\n\n    /// Query transaction by hash.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the query fails.\n    pub async fn get_tx(&mut self, hash: &str) -> Result<Tx, anyhow::Error> {\n        let req = GetTxRequest {\n            hash: hash.to_string(),\n        };\n        let response = self.tx.get_tx(req).await?.into_inner();\n\n        if let Some(tx) = response.tx {\n            // Convert through bytes since the types are incompatible","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/dydx/src/grpc/client.rs#L478-L514","documentation":"broadcast_tx checks the broadcast response for the optional `tx_response` field; if absent the node returned no receipt for the submitted transaction and the library raises instead of fabricating a tx hash. This means the broadcast result itself is missing, distinct from a tx that executed and failed (code != 0).","triggerScenarios":"Calling broadcast_tx (sync/async mode) when the node accepts the connection but returns a BroadcastTxResponse with tx_response unset — node overload, dropped result, or proto mismatch.","commonSituations":"Broadcasting during node instability or maintenance; hitting a rate-limited public RPC; using a mode the node doesn't support so no receipt is generated.","solutions":["Retry the broadcast; if using BROADCAST_MODE_ASYNC, consider SYNC to always receive a receipt.","Switch to a healthier RPC endpoint.","After a missing receipt, look up the tx by hash of the signed bytes later, since the tx may still have been committed.","Check node rate limits / authentication requirements on the RPC provider."],"exampleFix":"// before\nlet hash = client.broadcast_tx(&tx_bytes).await?;\n// after: retry once with SYNC mode\nlet hash = match client.broadcast_tx(&tx_bytes).await {\n    Ok(h) => h,\n    Err(e) if e.to_string().contains(\"does not contain tx_response\") => {\n        client.broadcast_tx_mode(&tx_bytes, BroadcastMode::Sync).await?\n    }\n    Err(e) => return Err(e),\n};","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.broadcast_tx(&tx_bytes).await {\n    Ok(hash) => Ok(hash),\n    Err(e) if e.to_string().contains(\"does not contain tx_response\") => {\n        tokio::time::sleep(Duration::from_secs(1)).await;\n        client.broadcast_tx(&tx_bytes).await\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Prefer BROADCAST_MODE_SYNC so receipts are always returned","Retry idempotently-safe broadcasts with backoff","Record signed tx hashes so results can be looked up later if a receipt is lost"],"tags":["grpc","cosmos","broadcast","transaction"],"backgroundTag":"empty-response-body","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"}