{"record":{"id":"fdb1dfff268e25aa","repo":"FuelLabs/fuel-core","slug":"contract-tx-pointer-cannot-be-greater-than-genesis","errorCode":null,"errorMessage":"contract tx_pointer cannot be greater than genesis block","messagePattern":"contract tx_pointer 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":257,"sourceCode":"        .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>,\n    height: BlockHeight,\n) -> anyhow::Result<()> {\n    let contract_id = entry.key;\n\n    if entry.value.tx_pointer().block_height() > height {\n        return Err(anyhow!(\n            \"contract tx_pointer cannot be greater than genesis block\"\n        ));\n    }\n\n    if transaction\n        .storage::<ContractsLatestUtxo>()\n        .replace(&contract_id, &entry.value)?\n        .is_some()\n    {\n        return Err(anyhow!(\"Contract utxo should not exist\"));\n    }\n\n    Ok(())\n}\n\nfn init_blob_payload(\n    transaction: &mut StorageTransaction<&mut GenesisDatabase>,\n    entry: &TableEntry<BlobData>,","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/service/genesis/importer/on_chain.rs#L239-L275","documentation":"Thrown by init_contract_latest_utxo during on-chain genesis import. Each ContractsLatestUtxo entry records the utxo that last created or updated a contract, and its tx_pointer must reference a block at or below the height of the genesis block being imported. When entry.value.tx_pointer().block_height() exceeds that height, the contract would point at a block that does not exist yet at genesis, so the import is rejected.","triggerScenarios":"A genesis or state snapshot whose contracts_latest_utxo entries carry tx_pointer block heights greater than the genesis block height set in the chain config — for example exporting state at height H but declaring a lower genesis height, or hand-editing tx_pointer fields.","commonSituations":"Building a test-network genesis from a snapshot taken at a higher height; shrinking the declared genesis height to compress the chain without rewriting snapshot pointers; snapshot tooling version changes that emit absolute instead of relative heights.","solutions":["Raise the genesis block height in the chain config so it is greater than or equal to the maximum tx_pointer block height across all ContractsLatestUtxo entries.","Or rewrite the offending entries' tx_pointer block heights to values at or below the genesis height (regenerating the snapshot is safer than hand edits).","Re-export the snapshot at the exact height you declare as genesis so heights stay consistent."],"exampleFix":"// before: chain config declares genesis height 42,\n// but a contracts_latest_utxo entry has tx_pointer.block_height = 50\n{ \"tx_pointer\": { \"block_height\": 50, \"tx_index\": 0 } }\n\n// after: make the genesis height cover the pointer\n// chain_config: \"height\": 50\n// (or set the entry's tx_pointer.block_height to <= 42)","handlingStrategy":"validation","validationCode":"fn validate_contract_utxo_heights(\n    entries: &[TableEntry<ContractsLatestUtxo>],\n    genesis_height: u32,\n) -> Result<(), String> {\n    for e in entries {\n        if e.value.tx_pointer().block_height().as_u32() > genesis_height {\n            return Err(format!(\n                \"contract {} tx_pointer height {} above genesis height {}\",\n                e.key,\n                e.value.tx_pointer().block_height(),\n                genesis_height\n            ));\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match importer.run().await {\n    Err(e) if e.to_string().contains(\"tx_pointer cannot be greater than genesis\") => {\n        // fix snapshot heights or raise genesis height; not retryable as-is\n    }\n    rest => rest,\n}","preventionTips":["Always export snapshots at the exact height declared as genesis.","Add a CI check comparing max tx_pointer height across state tables against the declared genesis height.","Never hand-edit tx_pointer fields in snapshots."],"tags":["genesis","storage","validation","fuel-core","rust"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}