{"record":{"id":"677c70d2c11c5b64","repo":"FuelLabs/fuels-ts","slug":"funds-too-low","errorCode":"FUNDS_TOO_LOW","errorMessage":"Insufficient balance to deploy contract.","messagePattern":"Insufficient balance to deploy contract\\.","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/contract/src/contract-factory.ts","lineNumber":332,"sourceCode":"          gasPrice,\n          gas: minGas,\n          priceFactor,\n          tip: transactionRequest.tip,\n        }).add(1);\n\n        totalCost = totalCost.add(minFee);\n      }\n      const createMinGas = createRequest.calculateMinGas(chainInfo);\n      const createMinFee = calculateGasFee({\n        gasPrice,\n        gas: createMinGas,\n        priceFactor,\n        tip: createRequest.tip,\n      }).add(1);\n      totalCost = totalCost.add(createMinFee);\n    }\n    if (totalCost.gt(await account.getBalance())) {\n      throw new FuelError(ErrorCode.FUNDS_TOO_LOW, 'Insufficient balance to deploy contract.');\n    }\n\n    // Transaction id is unset until we have funded the create tx, which is dependent on the blob txs\n    let txIdResolver: (value: string | PromiseLike<string>) => void;\n    const txIdPromise = new Promise<string>((resolve) => {\n      txIdResolver = resolve;\n    });\n\n    const waitForResult = async () => {\n      // Upload the blob if it hasn't been uploaded yet. Duplicate blob IDs will fail gracefully.\n      const uploadedBlobs: string[] = [];\n      // Deploy the chunks as blob txs\n      for (const { blobId, transactionRequest } of chunks) {\n        if (!uploadedBlobs.includes(blobId) && blobIdsToUpload.includes(blobId)) {\n          const fundedBlobRequest = await this.assembleTx(transactionRequest, deployOptions);\n\n          let result: TransactionResult<TransactionType.Blob>;\n","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/contract/src/contract-factory.ts#L314-L350","documentation":"Thrown by ContractFactory.deployAsBlobTx() (packages/contract/src/contract-factory.ts:332) when the total estimated cost of all blob transactions plus the create (loader) transaction exceeds the account's current balance. The total cost is computed by summing calculateGasFee for each blob chunk's min gas and the create request's min gas, using the provider's estimated gas price and the chain's gasPriceFactor. This is a pre-flight check before any transaction is submitted.","triggerScenarios":"Calling factory.deployAsBlobTx() (or factory.deploy() when bytecode exceeds the size limit) with an account whose base-asset balance is insufficient to cover the combined gas fees of all blob uploads and the final create transaction.","commonSituations":"Deploying a large contract with a freshly funded wallet that has not received enough base assets; gas price spikes on the network inflating the estimate; many blob chunks multiplying the per-chunk cost; deploying to a testnet with faucet limits.","solutions":["Fund the deploying account with more base assets and retry.","Reduce the number of chunks by increasing chunkSizeMultiplier (closer to 1.0) so each blob carries more bytecode.","Wait for gas prices to decrease and retry, or set a lower tip in deployOptions.","Check account.getBalance() before deploying to fail fast with actionable information."],"exampleFix":"// before\nawait factory.deployAsBlobTx();\n\n// after\nconst balance = await account.getBalance();\nif (balance.lte(0)) {\n  throw new Error('Account has no base assets; fund it before deploying');\n}\nawait factory.deployAsBlobTx();","handlingStrategy":"validation","validationCode":"const balance = await account.getBalance();\nconst { consensusParameters } = await account.provider.getChain();\nconst gasPrice = await account.provider.estimateGasPrice(10);\n\n// Rough estimate: number of chunks * per-chunk gas cost\nconst estimatedCost = bn(estimatedGas).mul(gasPrice);\nif (estimatedCost.gt(balance)) {\n  throw new Error(`Insufficient balance (${balance}) for estimated deploy cost (${estimatedCost})`);\n}\nawait factory.deployAsBlobTx();","typeGuard":null,"tryCatchPattern":"try {\n  await factory.deployAsBlobTx();\n} catch (e) {\n  if (e instanceof FuelError && e.code === 'funds-too-low') {\n    // fund the account, then retry\n    await fundAccount(account);\n    await factory.deployAsBlobTx();\n  } else {\n    throw e;\n  }\n}","preventionTips":["Check account.getBalance() before deploying large contracts.","Fund accounts with a buffer above the estimated cost to account for gas price fluctuations.","Use a higher chunkSizeMultiplier to reduce the number of blob transactions and total gas cost.","Estimate the number of chunks: Math.ceil(bytecode.length / maxChunkSize)."],"tags":["contract","deployment","funds","gas","blob-tx","balance"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}