{"record":{"id":"8cd59080d4bc0df4","repo":"FuelLabs/fuels-ts","slug":"transaction-error","errorCode":"TRANSACTION_ERROR","errorMessage":"Transaction's gasLimit must be equal to or greater than the combined forwarded gas of all calls.","messagePattern":"Transaction's gasLimit must be equal to or greater than the combined forwarded gas of all calls\\.","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/program/src/functions/base-invocation-scope.ts","lineNumber":234,"sourceCode":"    // Check if gasLimit is less than the\n    // sum of all call gasLimits\n    this.checkGasLimitTotal();\n\n    if (this.transactionRequest.type === TransactionType.Script) {\n      this.transactionRequest.abis = getAbisFromAllCalls(this.functionInvocationScopes);\n    }\n  }\n\n  /**\n   * Checks if the total gas limit is within the acceptable range.\n   */\n  protected checkGasLimitTotal() {\n    const gasLimitOnCalls = this.calls.reduce((total, call) => total.add(call.gas || 0), bn(0));\n\n    if (this.transactionRequest.gasLimit.eq(0)) {\n      this.transactionRequest.gasLimit = gasLimitOnCalls;\n    } else if (gasLimitOnCalls.gt(this.transactionRequest.gasLimit)) {\n      throw new FuelError(\n        ErrorCode.TRANSACTION_ERROR,\n        \"Transaction's gasLimit must be equal to or greater than the combined forwarded gas of all calls.\"\n      );\n    }\n  }\n\n  /**\n   * Gets the transaction cost for dry running the transaction.\n   *\n   * @returns The transaction cost details.\n   *\n   * @deprecated Use contract.fundWithRequiredCoins instead\n   * Check the migration guide https://docs.fuel.network/docs/fuels-ts/transactions/assemble-tx-migration-guide/ for more information.\n   */\n  async getTransactionCost(): Promise<TransactionCost> {\n    const request = clone(await this.getTransactionRequest());\n    const account: AbstractAccount =\n      this.program.account ?? Wallet.generate({ provider: this.getProvider() });","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/program/src/functions/base-invocation-scope.ts#L216-L252","documentation":"Thrown by checkGasLimitTotal during transaction preparation when the sum of per-call forwarded gas across all calls in a multicall exceeds the transaction's top-level gasLimit. Each call reserves `call.gas` units forwarded into the script; the request must carry at least that much total gas or execution cannot satisfy all forwarding budgets.","triggerScenarios":"Building a multicall where individual calls have `gas` set and you also set `tx.gasLimit` to a value below their sum; or programmatically lowering gasLimit after setting per-call gas.","commonSituations":"Manually capping gasLimit to save fees below what the calls need, mixing per-call gas overrides with a global cap, migrating a config that sets a low gasLimit.","solutions":["Leave transactionRequest.gasLimit at 0 so the SDK auto-sets it to the sum of per-call gas.","Or raise gasLimit to at least the total forwarded gas.","Reduce the per-call `gas` values if the total is genuinely too high.","Compute the sum of call.gas and set gasLimit accordingly before preparing the tx."],"exampleFix":"// before\nconst scope = contract.functions.foo().addArgs(...);\nscope.txParameters.gasLimit = bn(1000); // too low\n// after — let the SDK sum forwarded gas\nscope.txParameters.gasLimit = bn(0);\n// or set it high enough\nconst total = scope.calls.reduce((t, c) => t.add(c.gas || 0), bn(0));\nscope.txParameters.gasLimit = total;","handlingStrategy":"validation","validationCode":"import { bn } from '@fuel-ts/math';\nfunction ensureGasLimitCoversCalls(scope: any): void {\n  const total = scope.calls.reduce((t: any, c: any) => t.add(c.gas || 0), bn(0));\n  if (scope.transactionRequest.gasLimit.gt(0) && total.gt(scope.transactionRequest.gasLimit)) {\n    throw new Error(`gasLimit ${scope.transactionRequest.gasLimit} < forwarded ${total}`);\n  }\n}","typeGuard":"const gasLimitCoversCalls = (gasLimit: import('@fuel-ts/math').BN, calls: { gas?: number }[]): boolean => {\n  const total = calls.reduce((t, c) => t.add(c.gas || 0), bn(0));\n  return gasLimit.eq(0) || !total.gt(gasLimit);\n};","tryCatchPattern":null,"preventionTips":["Leave gasLimit at 0 in multicalls to let the SDK auto-sum per-call gas.","When capping gasLimit, compute the forwarded total first.","Avoid mixing per-call gas overrides with a hard global cap below their sum."],"tags":["transaction","gas","multicall","configuration"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}