{"record":{"id":"216887f390c3531a","repo":"FuelLabs/fuel-core","slug":"message-should-not-exist","errorCode":null,"errorMessage":"Message should not exist","messagePattern":"Message should not exist","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/fuel-core/src/service/genesis/importer/on_chain.rs","lineNumber":329,"sourceCode":"fn init_da_message(\n    transaction: &mut StorageTransaction<&mut GenesisDatabase>,\n    msg: TableEntry<Messages>,\n    da_height: DaBlockHeight,\n) -> anyhow::Result<()> {\n    let message: Message = msg.value;\n\n    if message.da_height() > da_height {\n        return Err(anyhow!(\n            \"message da_height cannot be greater than genesis da block height\"\n        ));\n    }\n\n    if transaction\n        .storage::<Messages>()\n        .replace(message.id(), &message)?\n        .is_some()\n    {\n        return Err(anyhow!(\"Message should not exist\"));\n    }\n\n    Ok(())\n}\n","sourceCodeStart":311,"sourceCodeEnd":334,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/service/genesis/importer/on_chain.rs#L311-L334","documentation":"Duplicate guard for Messages during on-chain genesis import: replace(message.id(), &message) returned Some. A message with the same id (deterministic from sender, recipient, nonce, body and other fields) was already inserted in this batch or already exists in storage.","triggerScenarios":"The same message listed twice in the genesis messages (same sender, recipient, nonce, and body), or import into a database that already contains those messages.","commonSituations":"Bridge message dumps containing replayed duplicates; snapshot concatenation without dedup; dirty db from a previous import.","solutions":["Dedupe messages by message id in the genesis state and re-import.","Wipe the db directory and re-run the import.","Regenerate the message list from the source of truth with deduplication."],"exampleFix":"// before: same message (same nonce + sender + body) twice\n\"messages\": [\n  { \"sender\": \"0x...\", \"recipient\": \"0x...\", \"nonce\": \"0x1\", \"amount\": \"100\", \"data\": \"0x\" },\n  { \"sender\": \"0x...\", \"recipient\": \"0x...\", \"nonce\": \"0x1\", \"amount\": \"100\", \"data\": \"0x\" }\n]\n\n// after: single entry\n\"messages\": [ { \"sender\": \"0x...\", \"recipient\": \"0x...\", \"nonce\": \"0x1\", \"amount\": \"100\", \"data\": \"0x\" } ]","handlingStrategy":"validation","validationCode":"fn validate_message_uniqueness(\n    messages: &[fuel_core::chain_config::MessageConfig],\n) -> Result<(), String> {\n    let mut seen = std::collections::HashSet::new();\n    for m in messages {\n        let id = fuel_core_types::fuel_types::MessageId::new(\n            &m.sender,\n            &m.recipient,\n            &m.nonce,\n            m.amount,\n            &m.data,\n        );\n        if !seen.insert(id) {\n            return Err(format!(\"duplicate message id {id} in genesis state\"));\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match importer.run().await {\n    Err(e) if e.to_string().contains(\"Message should not exist\") => {\n        // dedupe messages by id and re-import into clean storage\n    }\n    rest => rest,\n}","preventionTips":["Dedupe bridge-message dumps by nonce before writing them into genesis.","Never concatenate message lists without deduplication.","Validate that the db is empty before genesis import."],"tags":["genesis","messages","duplicate-data","fuel-core","rust"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}