{"record":{"id":"753ba8538a2cb30f","repo":"FuelLabs/fuel-core","slug":"unable-to-add-more-inputs-because-reached-the-maxi","errorCode":null,"errorMessage":"Unable to add more inputs because reached the maximum allowed inputs limit","messagePattern":"Unable to add more inputs because reached the maximum allowed inputs limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/fuel-core/src/schema/tx/assemble_tx.rs","lineNumber":533,"sourceCode":"\n        if let Some(utxo_id) = input.utxo_id() {\n            self.arguments.exclude.exclude(CoinId::Utxo(*utxo_id));\n        }\n\n        if let Some(nonce) = input.nonce() {\n            self.arguments.exclude.exclude(CoinId::Message(*nonce));\n        }\n\n        if let Some(asset_id) = input.asset_id(&base_asset_id) {\n            self.satisfy_change_policy(*asset_id)?;\n        }\n\n        self.tx.inputs_mut().push(input);\n\n        let max_inputs = self.arguments.consensus_parameters.tx_params().max_inputs();\n\n        if self.tx.inputs().len() > max_inputs as usize {\n            return Err(anyhow::anyhow!(\n                \"Unable to add more inputs \\\n                because reached the maximum allowed inputs limit\"\n            ));\n        }\n\n        Ok(())\n    }\n\n    fn satisfy_change_policy(&mut self, asset_id: AssetId) -> anyhow::Result<()> {\n        if self.set_change_outputs.insert(asset_id) {\n            let change_policy =\n                if let Some(policy) = self.change_output_policies.get(&asset_id) {\n                    *policy\n                } else {\n                    ChangePolicy::Change(self.fee_payer_account.owner())\n                };\n\n            match change_policy {","sourceCodeStart":515,"sourceCodeEnd":551,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/schema/tx/assemble_tx.rs#L515-L551","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait client.assembleTx(txBytes, { requiredBalances, reserveGas: 1_000_000, /* high gas price */ });\n\n// after\nawait sweepDust(client, feeAccount); // merge dust into one coin\nawait client.assembleTx(txBytes, { requiredBalances, reserveGas: 0 });","handlingStrategy":"validation","validationCode":"// rough pre-check: coins needed for fee depend on gas price and coin sizes\nconst { coins } = await client.request(COINS_QUERY(feeAccount, BASE_ASSET));\nconst minCoinsForFee = Math.ceil(estimatedFee / Math.max(...coins.map(c => Number(c.amount)), 1));\nif (tx.inputs.length + requiredBalances.length + minCoinsForFee > maxInputs) {\n  throw new Error('input limit would be exceeded; consolidate first');\n}","typeGuard":null,"tryCatchPattern":"catch (e) { if (/reached the maximum allowed inputs limit/.test(e.message)) { /* consolidate wallet UTXOs, reduce reserveGas/tip, split tx */ } else throw e; }","preventionTips":["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"],"tags":["transaction","consensus","inputs","utxo","fee","assemble-tx"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}