{"record":{"id":"4af8fb1cabced5b1","repo":"FuelLabs/fuel-core","slug":"coin-tx-pointer-height-coin-height-cannot-be-g","errorCode":null,"errorMessage":"coin tx_pointer height ({coin_height}) cannot be greater than genesis block ({height})","messagePattern":"coin tx_pointer height \\((.+?)\\) cannot be greater than genesis block \\((.+?)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/fuel-core/src/service/genesis/importer/on_chain.rs","lineNumber":233,"sourceCode":"    transaction: &mut StorageTransaction<&mut GenesisDatabase>,\n    coin: &TableEntry<Coins>,\n    height: BlockHeight,\n) -> anyhow::Result<()> {\n    let utxo_id = coin.key;\n\n    let compressed_coin = Coin {\n        utxo_id,\n        owner: *coin.value.owner(),\n        amount: *coin.value.amount(),\n        asset_id: *coin.value.asset_id(),\n        tx_pointer: *coin.value.tx_pointer(),\n    }\n    .compress();\n\n    // ensure coin can't point to blocks in the future\n    let coin_height = coin.value.tx_pointer().block_height();\n    if coin_height > height {\n        return Err(anyhow!(\n            \"coin tx_pointer height ({coin_height}) cannot be greater than genesis block ({height})\"\n        ));\n    }\n\n    if transaction\n        .storage::<Coins>()\n        .replace(&utxo_id, &compressed_coin)?\n        .is_some()\n    {\n        return Err(anyhow!(\"Coin should not exist\"));\n    }\n\n    Ok(())\n}\n\nfn init_contract_latest_utxo(\n    transaction: &mut StorageTransaction<&mut GenesisDatabase>,\n    entry: &TableEntry<ContractsLatestUtxo>,","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/service/genesis/importer/on_chain.rs#L215-L251","documentation":"During genesis snapshot import, each coin's tx_pointer.block_height() must be <= the genesis block height; a pointer above genesis references blocks that do not exist yet, so import_db fails fast rather than storing a forward-pointing coin. This validates snapshot integrity at import time.","triggerScenarios":"Importing a snapshot (genesis chain config / snapshot reader) that contains a coin whose tx_pointer height exceeds the chain's genesis height — e.g. state converted from a live chain without resetting coin pointers.","commonSituations":"Converting existing chain state into a genesis snapshot without zeroing tx_pointers; hand-edited snapshots; snapshots generated by tooling that copies original block heights.","solutions":["Regenerate the snapshot with every coin's tx_pointer height <= genesis height (zero or genesis height).","Pre-validate the snapshot's coins before import (see validation snippet).","For migrating live chains, use the proper migration path instead of a genesis snapshot."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-validate the snapshot before import: every coin's tx_pointer height\n// must be <= genesis height.\nfn snapshot_coins_valid(\n    coins: impl Iterator<Item = (UtxoId, CoinConfig)>,\n    genesis_height: u32,\n) -> Result<(), String> {\n    for (utxo_id, coin) in coins {\n        let h = coin.tx_pointer.block_height();\n        if h > genesis_height {\n            return Err(format!(\n                \"coin {utxo_id} tx_pointer height {h} > genesis {genesis_height}\"\n            ));\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = import_result {\n    if e.to_string().contains(\"cannot be greater than genesis block\") {\n        return Err(anyhow!(\"snapshot invalid: fix coin tx_pointer heights and regenerate\"));\n    }\n    return Err(e);\n}","preventionTips":["Generate snapshots only with tooling that clamps tx_pointer heights to <= genesis height.","Validate snapshots (coins' tx_pointers) in CI before any node consumes them.","Never hand-edit coin heights when converting live state into genesis snapshots."],"tags":["genesis","snapshot","coins","validation"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}