{"record":{"id":"93bc4a0696dc6091","repo":"FuelLabs/fuels-ts","slug":"max-fee-too-low-93bc4a","errorCode":"MAX_FEE_TOO_LOW","errorMessage":"Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.","messagePattern":"Max fee '(.+?)' is lower than the required: '(.+?)'\\.","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/program/src/functions/base-invocation-scope.ts","lineNumber":675,"sourceCode":"  ) {\n    const gasLimitSpecified = isDefined(this.txParameters?.gasLimit) || this.hasCallParamsGasLimit;\n    const maxFeeSpecified = isDefined(this.txParameters?.maxFee);\n\n    const { gasLimit: setGasLimit, maxFee: setMaxFee } = transactionRequest;\n\n    if (!gasLimitSpecified) {\n      transactionRequest.gasLimit = gasUsed;\n    } else if (setGasLimit.lt(gasUsed)) {\n      throw new FuelError(\n        ErrorCode.GAS_LIMIT_TOO_LOW,\n        `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`\n      );\n    }\n\n    if (!maxFeeSpecified) {\n      transactionRequest.maxFee = maxFee;\n    } else if (maxFee.gt(setMaxFee)) {\n      throw new FuelError(\n        ErrorCode.MAX_FEE_TOO_LOW,\n        `Max fee '${setMaxFee}' is lower than the required: '${maxFee}'.`\n      );\n    }\n  }\n}\n","sourceCodeStart":657,"sourceCodeEnd":682,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/program/src/functions/base-invocation-scope.ts#L657-L682","documentation":"Thrown while finalizing a funded transaction when an explicit maxFee was supplied (txParameters.maxFee) but it is below the maxFee the SDK computed as required for the transaction. Like gasLimit, when maxFee is omitted the SDK sets it automatically; when supplied and too low, it errors rather than silently clamping.","triggerScenarios":"Calling .tx({ maxFee: N }) with N below the required max fee; setting maxFee from a hard-coded constant that predates a gas-price or byte-size change.","commonSituations":"Hard-coding maxFee to a small constant; raising gasLimit/inputs (which raises required fee) without updating maxFee; mainnet vs testnet gas-price differences.","solutions":["Omit maxFee and let the SDK derive it from gasLimit, gas price, and byte size.","If you must set it, raise txParameters.maxFee to >= the value shown in the error (with a margin).","Verify the provider's current gas price (await provider.getGasConfig()) before computing a maxFee."],"exampleFix":"// before\nawait contract.functions.fn().tx({ maxFee: 100 }).call();\n\n// after\nawait contract.functions.fn().call();\n// or explicit adequate value\nawait contract.functions.fn().tx({ maxFee: 100_000_000 }).call();","handlingStrategy":"validation","validationCode":"// Let the SDK compute maxFee; only set it after reading the gas config.\n// const gasConfig = await provider.getGasConfig();\n// then, if needed, set maxFee >= computed required maxFee.","typeGuard":null,"tryCatchPattern":"try {\n  await contract.functions.fn().tx({ maxFee }).call();\n} catch (e) {\n  if (e instanceof FuelError && e.code === ErrorCode.MAX_FEE_TOO_LOW) {\n    await contract.functions.fn().call(); // let SDK derive maxFee\n  } else throw e;\n}","preventionTips":["Avoid hard-coded maxFee; the SDK derives it from gasLimit, price, and byte size.","Account for gas-price differences between networks before pinning maxFee.","Re-check maxFee whenever you raise gasLimit or add inputs."],"tags":["fee","transaction","estimation","typescript"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}