{"record":{"id":"d8f027a95e403df4","repo":"FuelLabs/fuels-ts","slug":"max-outputs-exceeded","errorCode":"MAX_OUTPUTS_EXCEEDED","errorMessage":"The transaction exceeds the maximum allowed number of outputs. Tx outputs: ${tx.outputs.length}, max outputs: ${maxOutputs}","messagePattern":"The transaction exceeds the maximum allowed number of outputs\\. Tx outputs: (.+?), max outputs: (.+?)","errorType":"validation","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/account/src/providers/provider.ts","lineNumber":1114,"sourceCode":"\n  /**\n   * @hidden\n   */\n  async validateTransaction(tx: TransactionRequest) {\n    const {\n      consensusParameters: {\n        txParameters: { maxInputs, maxOutputs },\n      },\n    } = await this.getChain();\n    if (bn(tx.inputs.length).gt(maxInputs)) {\n      throw new FuelError(\n        ErrorCode.MAX_INPUTS_EXCEEDED,\n        `The transaction exceeds the maximum allowed number of inputs. Tx inputs: ${tx.inputs.length}, max inputs: ${maxInputs}`\n      );\n    }\n\n    if (bn(tx.outputs.length).gt(maxOutputs)) {\n      throw new FuelError(\n        ErrorCode.MAX_OUTPUTS_EXCEEDED,\n        `The transaction exceeds the maximum allowed number of outputs. Tx outputs: ${tx.outputs.length}, max outputs: ${maxOutputs}`\n      );\n    }\n  }\n\n  /**\n   * Submits a transaction to the chain to be executed.\n   *\n   * If the transaction is missing any dependencies,\n   * the transaction will be mutated and those dependencies will be added.\n   *\n   * @param transactionRequestLike - The transaction request object.\n   * @param sendTransactionParams - The provider send transaction parameters (optional).\n   * @returns A promise that resolves to the transaction response object.\n   */\n  async sendTransaction(\n    transactionRequestLike: TransactionRequestLike,","sourceCodeStart":1096,"sourceCodeEnd":1132,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/account/src/providers/provider.ts#L1096-L1132","documentation":"Thrown by Provider.validateTransaction when the number of outputs on a transaction request exceeds the chain's consensus parameter txParameters.maxOutputs. As with inputs, the chain would reject the tx, so validation fails fast. The limit is read from consensus parameters and may vary by network/upgrade.","triggerScenarios":"Calling provider.validateTransaction(tx) with a transactionRequest.outputs longer than maxOutputs; building a batch transfer to many recipients in a single tx; adding a change output plus many explicit recipient outputs; adding variable outputs without limit.","commonSituations":"Airdrop/distribution tx with many recipients; adding multiple withdrawal outputs; mint/batch-mint script emitting many transfer outputs; maxOutputs lowered by a consensus parameter update.","solutions":["Split the transaction: batch recipients across several txs so each stays under maxOutputs.","Check (await provider.getChain()).consensusParameters.txParameters.maxOutputs and size outputs accordingly.","Prefer change outputs over explicit outputs where possible to reduce the count.","For distributions, stream transfers rather than one mega-tx."],"exampleFix":"// before — too many recipient outputs in one tx\nconst tx = new ScriptTransactionRequest();\nrecipients.forEach(r => tx.addCoinOutput(r.address, r.amount, assetId));\nawait provider.validateTransaction(tx);\n\n// after — chunk by maxOutputs\nconst { maxOutputs } = (await provider.getChain()).consensusParameters.txParameters;\nconst limit = maxOutputs.toNumber() - 1; // reserve a change output\nfor (const batch of chunk(recipients, limit)) {\n  const tx = new ScriptTransactionRequest();\n  batch.forEach(r => tx.addCoinOutput(r.address, r.amount, assetId));\n  await provider.sendTransaction(tx); // one tx per batch\n}","handlingStrategy":"validation","validationCode":"async function assertOutputsUnderLimit(provider, tx) {\n  const { maxOutputs } = (await provider.getChain()).consensusParameters.txParameters;\n  if (tx.outputs.length > maxOutputs.toNumber()) {\n    throw new Error(`Too many outputs (${tx.outputs.length} > ${maxOutputs}); split the tx.`);\n  }\n}","typeGuard":"function outputsFitLimit(outputCount: number, maxOutputs: { toNumber(): number }): boolean {\n  return outputCount <= maxOutputs.toNumber();\n}","tryCatchPattern":"import { FuelError, ErrorCode } from '@fuel-ts/errors';\ntry {\n  await provider.validateTransaction(tx);\n} catch (e) {\n  if (e instanceof FuelError && e.code === ErrorCode.MAX_OUTPUTS_EXCEEDED) {\n    // split recipients across multiple txs and retry each\n  }\n  throw e;\n}","preventionTips":["Batch large recipient lists across multiple transactions.","Read maxOutputs from consensus parameters before distribution loops.","Reserve room for a change output when computing capacity."],"tags":["transaction","consensus-params","outputs","validation"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}