{"record":{"id":"9be5926b8038177b","repo":"FuelLabs/fuels-ts","slug":"invalid-chunk-size-multiplier","errorCode":"INVALID_CHUNK_SIZE_MULTIPLIER","errorMessage":"Chunk size multiplier must be between 0 and 1","messagePattern":"Chunk size multiplier must be between 0 and 1","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/contract/src/contract-factory.ts","lineNumber":477,"sourceCode":"  private blobTransactionRequest(options: { bytecode: BytesLike } & DeployContractOptions) {\n    const { bytecode } = options;\n    return new BlobTransactionRequest({\n      blobId: hash(bytecode),\n      witnessIndex: 0,\n      witnesses: [bytecode],\n      ...options,\n    });\n  }\n\n  /**\n   * Get the maximum chunk size for deploying a contract by chunks.\n   */\n  private async getMaxChunkSize(\n    deployOptions: DeployContractOptions,\n    chunkSizeMultiplier: number = CHUNK_SIZE_MULTIPLIER\n  ) {\n    if (chunkSizeMultiplier < 0 || chunkSizeMultiplier > 1) {\n      throw new FuelError(\n        ErrorCode.INVALID_CHUNK_SIZE_MULTIPLIER,\n        'Chunk size multiplier must be between 0 and 1'\n      );\n    }\n\n    const account = this.getAccount();\n    const { consensusParameters } = await account.provider.getChain();\n    const contractSizeLimit = consensusParameters.contractParameters.contractMaxSize.toNumber();\n    const transactionSizeLimit = consensusParameters.txParameters.maxSize.toNumber();\n    const maxLimit = 64000;\n    const chainLimit =\n      transactionSizeLimit < contractSizeLimit ? transactionSizeLimit : contractSizeLimit;\n    const sizeLimit = chainLimit < maxLimit ? chainLimit : maxLimit;\n\n    // Get an estimate base tx length\n\n    const blobTx = this.blobTransactionRequest({\n      ...deployOptions,","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/contract/src/contract-factory.ts#L459-L495","documentation":"Thrown by ContractFactory.getMaxChunkSize() (packages/contract/src/contract-factory.ts:477) when the chunkSizeMultiplier parameter is less than 0 or greater than 1. The multiplier scales the maximum blob chunk size as a fraction of the chain's transaction/contract size limit. The default value is CHUNK_SIZE_MULTIPLIER (0.95). This validation runs before any chain queries, so it fails immediately on bad input.","triggerScenarios":"Calling deployAsBlobTx({ chunkSizeMultiplier: X }) or deploy() (when it routes to blob-tx) with a chunkSizeMultiplier outside the range [0, 1] — e.g. passing a percentage like 95 instead of 0.95, a negative value, or a value > 1.","commonSituations":"Misinterpreting the multiplier as a percentage (passing 95 instead of 0.95); copying a value from configuration that uses a different scale; accidental integer division or type coercion producing a value outside bounds.","solutions":["Set chunkSizeMultiplier to a value between 0 and 1 (exclusive); the default 0.95 is almost always correct.","If you intended a percentage, divide by 100: e.g. 95 → 0.95.","Omit chunkSizeMultiplier entirely to use the default 0.95."],"exampleFix":"// before\nawait factory.deployAsBlobTx({ chunkSizeMultiplier: 95 });\n\n// after\nawait factory.deployAsBlobTx({ chunkSizeMultiplier: 0.95 });\n// or simply omit it:\n// await factory.deployAsBlobTx();","handlingStrategy":"validation","validationCode":"function validateChunkMultiplier(m?: number): number {\n  if (m === undefined) return 0.95; // default\n  if (m < 0 || m > 1) {\n    throw new Error(`chunkSizeMultiplier must be between 0 and 1, got: ${m}`);\n  }\n  return m;\n}\n\nawait factory.deployAsBlobTx({ chunkSizeMultiplier: validateChunkMultiplier(userValue) });","typeGuard":"function isValidChunkMultiplier(value: unknown): value is number {\n  return typeof value === 'number' && value >= 0 && value <= 1;\n}","tryCatchPattern":"try {\n  await factory.deployAsBlobTx({ chunkSizeMultiplier: userValue });\n} catch (e) {\n  if (e instanceof FuelError && e.code === 'invalid-chunk-size-multiplier') {\n    // userValue was outside [0, 1]; default to 0.95\n    await factory.deployAsBlobTx({ chunkSizeMultiplier: 0.95 });\n  } else {\n    throw e;\n  }\n}","preventionTips":["Remember chunkSizeMultiplier is a fraction (0-1), not a percentage (0-100).","Omit the option to use the safe default of 0.95.","Validate user-provided configuration values before passing them to deployAsBlobTx."],"tags":["contract","deployment","blob-tx","input-validation","configuration"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}