FuelLabs/fuel-core · error
The final fee is too big to fit into `u64`
Error message
The final fee is too big to fit into `u64`
What it means
After computing the final gas for the tx, the assembler converts gas to fee (gas_to_fee, computed in U256 using gas_price and the chain's gas_price_factor) and converts the result back to u64. The error fires when the computed fee exceeds u64::MAX — an arithmetic impossibility for sane gas prices.
Source
Thrown at crates/fuel-core/src/schema/tx/assemble_tx.rs:945
total_base_asset.checked_add(amount).ok_or_else(|| {
anyhow::anyhow!(
"The total base asset amount used by the transaction is too big"
)
})?;
}
}
}
loop {
let max_gas = self.tx.max_gas(&gas_costs, &fee_params);
let max_gas_with_reserve = max_gas.saturating_add(self.arguments.reserve_gas);
let final_gas = max_gas_with_reserve.min(max_gas_per_tx);
let final_fee =
gas_to_fee(final_gas, self.arguments.gas_price, gas_price_factor);
let final_fee = u64::try_from(final_fee)
.map_err(|_| {
anyhow::anyhow!("The final fee is too big to fit into `u64`")
})?
.saturating_add(self.tx.tip());
let need_to_cover = final_fee.saturating_add(self.base_asset_reserved);
if need_to_cover <= total_base_asset {
break
}
let remaining_input_slots = self.remaining_input_slots()?;
if remaining_input_slots == 0 {
return Err(CoinsQueryError::MaxCoinsReached {
owner: fee_payer_account.owner(),
asset_id: base_asset_id,
collected_amount: total_base_asset.into(),
max: self.arguments.consensus_parameters.tx_params().max_inputs(),
}
.into());View on GitHub (pinned to b9d4d170da)
Solutions
- Re-check the gas price you send: use the value from the node's estimateGasPrice, not a hand-scaled constant
- Lower the tx's gas ceiling (script gas limit, witness/data usage) so gas x price fits u64
- If you operate the chain, verify consensus parameter gas_price_factor is set correctly
Example fix
// before
await client.assembleTx(txBytes, { requiredBalances, gasPrice: 1_000_000_000_000n }); // wrong scale
// after
const { gasPrice } = await client.queryEstimateGasPrice(blockHorizon);
await client.assembleTx(txBytes, { requiredBalances /* node-derived gas price */ }); Defensive patterns
Strategy: validation
Validate before calling
// client-side mirror of gas_to_fee: fee = gas * gasPrice / gasPriceFactor
const fee = (BigInt(finalGas) * gasPrice) / BigInt(gasPriceFactor);
if (fee > 2n ** 64n - 1n) throw new Error(`fee ${fee} overflows u64; lower gas price or gas limit`); Try / catch
catch (e) { if (/final fee is too big to fit into/.test(e.message)) { /* use node-reported gas price, reduce script gas limit / tip */ } else throw e; } Prevention
- Always take gas price from the node's estimation endpoint instead of hardcoding
- Double-check unit scaling of any manual gas price (per-gas, not total)
- Chain operators: verify gas_price_factor in consensus parameters after upgrades
When it happens
Trigger: final_gas * gas_price / gas_price_factor > u64::MAX: an extreme gas_price combined with a large gas estimate, or a misconfigured gas_price_factor (e.g. 0-adjacent values in a custom chain making the division inflate the result).
Common situations: Passing a wrongly-scaled gas price (unit confusion, e.g. sending the full-token amount instead of per-gas amount); custom chains with a broken gas_price_factor consensus parameter.
Related errors
- Unable to add more inputs because reached the maximum allowe
- The total base asset amount used by the transaction is too b
- The total base asset amount became too big when tried to cov
- The transaction has more outputs than allowed by the consens
- The fee address index is out of bounds
AI-assisted analysis of FuelLabs/fuel-core@b9d4d170da (2026-08-16).
Data as JSON: /api/errors/d2713b956aeb707d.
Report an issue: GitHub.