FuelLabs/fuel-core · error
Unable to add more inputs because reached the maximum allowe
Error message
Unable to add more inputs because reached the maximum allowed inputs limit
What it means
add_input_and_witness_and_change pushes each selected coin (or message) as an input and then verifies the tx is still within tx_params.max_inputs. The error means the coin just added to satisfy a required balance or the fee pushed the input count over the chain limit.
Source
Thrown at crates/fuel-core/src/schema/tx/assemble_tx.rs:533
if let Some(utxo_id) = input.utxo_id() {
self.arguments.exclude.exclude(CoinId::Utxo(*utxo_id));
}
if let Some(nonce) = input.nonce() {
self.arguments.exclude.exclude(CoinId::Message(*nonce));
}
if let Some(asset_id) = input.asset_id(&base_asset_id) {
self.satisfy_change_policy(*asset_id)?;
}
self.tx.inputs_mut().push(input);
let max_inputs = self.arguments.consensus_parameters.tx_params().max_inputs();
if self.tx.inputs().len() > max_inputs as usize {
return Err(anyhow::anyhow!(
"Unable to add more inputs \
because reached the maximum allowed inputs limit"
));
}
Ok(())
}
fn satisfy_change_policy(&mut self, asset_id: AssetId) -> anyhow::Result<()> {
if self.set_change_outputs.insert(asset_id) {
let change_policy =
if let Some(policy) = self.change_output_policies.get(&asset_id) {
*policy
} else {
ChangePolicy::Change(self.fee_payer_account.owner())
};
match change_policy {View on GitHub (pinned to b9d4d170da)
Solutions
- Consolidate dust UTXOs for the fee account and each required asset into fewer, larger coins
- Lower the fee pressure: reduce tip/gas price, drop reserveGas, or shrink script gas usage so fewer coins are needed
- Split the operation across multiple transactions so each stays within max_inputs
Example fix
// before
await client.assembleTx(txBytes, { requiredBalances, reserveGas: 1_000_000, /* high gas price */ });
// after
await sweepDust(client, feeAccount); // merge dust into one coin
await client.assembleTx(txBytes, { requiredBalances, reserveGas: 0 }); Defensive patterns
Strategy: validation
Validate before calling
// rough pre-check: coins needed for fee depend on gas price and coin sizes
const { coins } = await client.request(COINS_QUERY(feeAccount, BASE_ASSET));
const minCoinsForFee = Math.ceil(estimatedFee / Math.max(...coins.map(c => Number(c.amount)), 1));
if (tx.inputs.length + requiredBalances.length + minCoinsForFee > maxInputs) {
throw new Error('input limit would be exceeded; consolidate first');
} Try / catch
catch (e) { if (/reached the maximum allowed inputs limit/.test(e.message)) { /* consolidate wallet UTXOs, reduce reserveGas/tip, split tx */ } else throw e; } Prevention
- Sweep dust into one coin per asset before multi-asset operations
- Fee coins count too: keep the fee account consolidated
- excludeInput lists shrink the coin pool and worsen fragmentation
When it happens
Trigger: Coin selection for a required balance or for fee coverage returned more coins than the remaining input slots — typically dusty base-asset coins gathered to cover gas, or many coins per asset in requiredBalances.
Common situations: Fee account paid with many micro-UTXOs so covering the fee needs >max_inputs coins; requiring spend of several assets whose balances are fragmented; exclude lists forcing selection of worse (dustier) coins.
Related errors
- Filling required balances occupies a number of inputs more t
- The transaction has more outputs than allowed by the consens
- The fee address index is out of bounds
- fee index out of bounds
- Unable to add more `Change` outputs because reached the maxi
AI-assisted analysis of FuelLabs/fuel-core@b9d4d170da (2026-08-16).
Data as JSON: /api/errors/753ba8538a2cb30f.
Report an issue: GitHub.