{"record":{"id":"b95a7d286518d591","repo":"FuelLabs/fuel-core","slug":"unable-to-add-more-change-outputs-because-reache","errorCode":null,"errorMessage":"Unable to add more `Change` outputs because reached the maximum allowed outputs limit","messagePattern":"Unable to add more `Change` outputs because reached the maximum allowed outputs limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/fuel-core/src/schema/tx/assemble_tx.rs","lineNumber":566,"sourceCode":"                    ChangePolicy::Change(self.fee_payer_account.owner())\n                };\n\n            match change_policy {\n                ChangePolicy::Change(change_receiver) => {\n                    self.tx.outputs_mut().push(Output::change(\n                        change_receiver,\n                        0,\n                        asset_id,\n                    ));\n\n                    let max_outputs = self\n                        .arguments\n                        .consensus_parameters\n                        .tx_params()\n                        .max_outputs();\n\n                    if self.tx.outputs().len() > max_outputs as usize {\n                        return Err(anyhow::anyhow!(\n                            \"Unable to add more `Change` outputs \\\n                            because reached the maximum allowed outputs limit\"\n                        ));\n                    }\n                }\n                ChangePolicy::Destroy => {\n                    // Do nothing for now, since `fuel-tx` crate doesn't have\n                    // `Destroy` output yet.\n                    // https://github.com/FuelLabs/fuel-specs/issues/621\n                }\n            }\n        }\n\n        Ok(())\n    }\n\n    fn is_runnable_script(&self) -> bool {\n        if let Some(script) = self.tx.as_script()","sourceCodeStart":548,"sourceCodeEnd":584,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/schema/tx/assemble_tx.rs#L548-L584","documentation":"For every new asset seen in the added inputs, the assembler creates a Change output (unless the policy is Destroy) and checks the tx stays within tx_params.max_outputs. The error fires when adding those Change outputs would exceed the output limit.","triggerScenarios":"Inputs added for required balances or fee introduce more distinct asset ids than there are free output slots, given the outputs already in your tx.","commonSituations":"Multi-asset transactions where every touched asset needs a Change output on top of pre-existing outputs; scripts with many pre-declared Variable outputs; chains with lowered max_outputs.","solutions":["Set changePolicy to Destroy for assets whose change you do not need back (no Change output is created)","Reduce pre-existing outputs in the tx or the number of distinct assets in requiredBalances","Split into several single-asset transactions"],"exampleFix":"// before\nawait client.assembleTx(txBytes, {\n  requiredBalances: assets.map((a) => ({ account, assetId: a, changeAccount: account })),\n});\n\n// after\nawait client.assembleTx(txBytes, {\n  requiredBalances: assets.map((a) => ({\n    account,\n    assetId: a,\n    changeAccount: null, // Destroy policy: no Change output per asset\n  })),\n});","handlingStrategy":"validation","validationCode":"const distinctAssets = new Set(requiredBalances.map(b => b.assetId)).size;\nif (tx.outputs.length + distinctAssets > maxOutputs) {\n  throw new Error(`output budget exceeded: ${tx.outputs.length} + ${distinctAssets} change outputs > ${maxOutputs}`);\n}","typeGuard":null,"tryCatchPattern":"catch (e) { if (/reached the maximum allowed outputs limit/.test(e.message)) { /* set changePolicy destroy for unneeded assets or reduce outputs */ } else throw e; }","preventionTips":["Use ChangePolicy::Destroy for assets whose remainder you can burn","Each distinct asset in inputs produces one Change output — budget for it","Split multi-asset sweeps into per-asset transactions"],"tags":["transaction","consensus","outputs","change-output","assemble-tx"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}