{"record":{"id":"0ee46b7b7005afd4","repo":"unionlabs/union","slug":"transaction-reverted-but-no-rawvalue-hex-found","errorCode":null,"errorMessage":"Transaction reverted but no rawValue hex found: {}","messagePattern":"Transaction reverted but no rawValue hex found: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"tools/union-test/src/lib.rs","lineNumber":1037,"sourceCode":"        msg: Src::Msg,\n        expected_revert_code: u32,\n        signer: &Src::ProviderType,\n    ) -> anyhow::Result<()> {\n        match source_chain\n            .send_ibc_transaction(contract.clone(), msg.clone(), signer)\n            .await\n        {\n            Ok((_, _)) => anyhow::bail!(\n                \"Expected revert 0x{:08x}, but transaction succeeded\",\n                expected_revert_code\n            ),\n\n            Err(e) => {\n                let err_str = format!(\"{:#}\", e);\n\n                let re = Regex::new(r\"(0x[0-9A-Fa-f]+)\").unwrap();\n                let caps = re.captures(&err_str).ok_or_else(|| {\n                    anyhow!(\n                        \"Transaction reverted but no rawValue hex found: {}\",\n                        err_str\n                    )\n                })?;\n\n                let hex_full = caps\n                    .get(1)\n                    .map(|m| m.as_str())\n                    .ok_or_else(|| anyhow!(\"regex matched but capture group missing\"))?;\n\n                let hexdigits = hex_full.trim_start_matches(\"0x\");\n                if hexdigits.len() < 8 {\n                    anyhow::bail!(\"rawValue too short for a selector: {}\", hex_full);\n                }\n                let selector_hex = &hexdigits[..8]; // first 4 bytes\n\n                let actual = u32::from_str_radix(selector_hex, 16).with_context(|| {\n                    format!(\"parsing revert selector `{selector_hex}` from `{hex_full}`\")","sourceCodeStart":1019,"sourceCodeEnd":1055,"githubUrl":"https://github.com/unionlabs/union/blob/031785bb6dc6b957c624e62bc64c184409c97d7b/tools/union-test/src/lib.rs#L1019-L1055","documentation":"send_and_expect_revert caught an Err from send_ibc_transaction (the expected revert) and tries to extract the raw revert value with the regex (0x[0-9A-Fa-f]+). This error says the transaction did fail, but the formatted error string {:#} of the anyhow chain contains no 0x… hex blob, so no revert selector can be parsed. The revert data got lost in provider formatting or the failure was not an execution revert at all (e.g. network error), so the harness cannot verify the expected selector.","triggerScenarios":"The send fails for a non-revert reason (connection reset, timeout, estimation error without revert data) while the test expected an on-chain revert; or the provider version formats revert data without a leading 0x prefix (e.g. bare hex) so the regex misses it.","commonSituations":"RPC hiccup at the moment the reverting tx is sent; alloy/ethers provider upgrade changing error Display formatting so the rawValue no longer appears; revert with empty data.","solutions":["Print/inspect the full err_str ({:#} chain) that the error message embeds — it shows whether the failure was a revert or an infrastructure error.","If the failure was infra (network/timeout), fix connectivity and rerun; the revert path itself is fine.","If the provider now formats revert data differently, update the regex to also match bare hex or pull the revert data from the typed provider error instead of string matching.","Pin the provider version whose error formatting this helper was written against."],"exampleFix":"// before — string-scrape the first hex blob\nlet re = Regex::new(r\"(0x[0-9A-Fa-f]+)\").unwrap();\n\n// after — prefer typed revert data when available, fall back to regex\nlet re = Regex::new(r\"(?:0x)?([0-9A-Fa-f]{8,})\").unwrap();","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let e = send_result.unwrap_err();\nlet err_str = format!(\"{e:#}\");\nlet sel = extract_selector(&err_str)\n    .ok_or_else(|| anyhow!(\"no revert data in error; raw error was: {err_str}\"))?;","preventionTips":["Pin the provider crate version whose error Display includes the raw revert hex.","Prefer typed accessors for revert data over string scraping when the provider exposes them."],"tags":["ibc","rust","revert","regex","provider"],"backgroundTag":null,"analyzedSha":"031785bb6dc6b957c624e62bc64c184409c97d7b","analyzedAt":"2026-08-16T06:24:09.996Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}