{"record":{"id":"048576257ec95826","repo":"FuelLabs/fuel-core","slug":"missing-tx-pointer-on-contract-input","errorCode":null,"errorMessage":"Missing tx_pointer on contract input","messagePattern":"Missing tx_pointer on contract input","errorType":"validation","errorClass":"Error::Serialization","httpStatus":null,"severity":"error","filePath":"crates/services/block_aggregator_api/src/blocks/old_block_source/convertor_adapter/proto_to_fuel_conversions.rs","lineNumber":120,"sourceCode":"    })?;\n    Ok(StorageSlot::new(key, value))\n}\n\nfn contract_input_from_proto(\n    proto: &ProtoContractInput,\n) -> crate::result::Result<fuel_core_types::fuel_tx::input::contract::Contract> {\n    let utxo_proto = proto.utxo_id.as_ref().ok_or_else(|| {\n        Error::Serialization(anyhow!(\"Missing utxo_id on contract input\"))\n    })?;\n    let utxo_id = utxo_id_from_proto(utxo_proto)?;\n    let balance_root = Bytes32::try_from(proto.balance_root.as_slice()).map_err(|e| {\n        Error::Serialization(anyhow!(\"Could not convert balance_root to Bytes32: {}\", e))\n    })?;\n    let state_root = Bytes32::try_from(proto.state_root.as_slice()).map_err(|e| {\n        Error::Serialization(anyhow!(\"Could not convert state_root to Bytes32: {}\", e))\n    })?;\n    let tx_pointer_proto = proto.tx_pointer.as_ref().ok_or_else(|| {\n        Error::Serialization(anyhow!(\"Missing tx_pointer on contract input\"))\n    })?;\n    let tx_pointer = tx_pointer_from_proto(tx_pointer_proto)?;\n    let contract_id =\n        fuel_core_types::fuel_types::ContractId::try_from(proto.contract_id.as_slice())\n            .map_err(|e| Error::Serialization(anyhow!(e)))?;\n\n    Ok(fuel_core_types::fuel_tx::input::contract::Contract {\n        utxo_id,\n        balance_root,\n        state_root,\n        tx_pointer,\n        contract_id,\n    })\n}\n\nfn contract_output_from_proto(\n    proto: &ProtoContractOutput,\n) -> crate::result::Result<fuel_core_types::fuel_tx::output::contract::Contract> {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/services/block_aggregator_api/src/blocks/old_block_source/convertor_adapter/proto_to_fuel_conversions.rs#L102-L138","documentation":"contract_input_from_proto requires the tx_pointer sub-message on every ProtoContractInput; prost yields None for absent optional message fields and this code converts that into Error::Serialization. fuel-core's Contract input type always carries a TxPointer, so an input without one cannot be represented and the whole block decode fails.","triggerScenarios":"Decoding a proto transaction whose contract input omitted the tx_pointer field - produced by an older/incompatible encoder, a third-party producer, or fixtures that fill only some sub-messages.","commonSituations":"Version skew across fuel-core releases that changed which sub-messages are populated; hand-written proto in tests; migration tooling that drops fields it does not understand.","solutions":["Debug-print the failing ProtoContractInput to identify missing sub-messages.","Fix the encoder to always populate tx_pointer (and utxo_id) for contract inputs.","Pre-validate presence of both sub-messages and reject the tx early with an index-annotated error.","Re-obtain the block from a compatible peer."],"exampleFix":"// before\nlet tx_pointer_proto = proto.tx_pointer.as_ref().ok_or_else(|| {\n    Error::Serialization(anyhow!(\"Missing tx_pointer on contract input\"))\n})?;\n\n// after: validate whole input first\nfn contract_input_complete(p: &ProtoContractInput) -> bool {\n    p.utxo_id.is_some() && p.tx_pointer.is_some()\n}\nif !contract_input_complete(input_proto) {\n    return Err(Error::Serialization(anyhow::anyhow!(\n        \"input[{i}] incomplete contract input\"\n    )));\n}","handlingStrategy":"type-guard","validationCode":"fn contract_input_has_tx_pointer(p: &ProtoContractInput) -> bool {\n    p.tx_pointer.is_some()\n}","typeGuard":"fn contract_input_complete(p: &ProtoContractInput) -> bool {\n    p.utxo_id.is_some() && p.tx_pointer.is_some()\n}","tryCatchPattern":"match contract_input_from_proto(p) {\n    Ok(input) => Some(input),\n    Err(Error::Serialization(ctx)) if ctx.to_string().contains(\"tx_pointer\") => {\n        tracing::warn!(?p, \"rejecting contract input without tx_pointer\");\n        None\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Require full sub-message presence on contract inputs before conversion.","Fix encoders to mirror fuel-core's Contract input (always sets UtxoId and TxPointer).","Test decode paths with intentionally-emptied sub-messages so failures are positional and logged."],"tags":["rust","fuel-core","protobuf","deserialization","contract-input","missing-field"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}