{"record":{"id":"5d6e6fd32fa866aa","repo":"remotion-dev/remotion","slug":"parameter-disksizeinmb-must-be-an-integer-but-go","errorCode":null,"errorMessage":"parameter 'diskSizeInMb' must be an integer but got ${diskSizeInMb}","messagePattern":"parameter 'diskSizeInMb' must be an integer but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/validate-disk-size-in-mb.ts","lineNumber":33,"sourceCode":"\t}\n\n\tif (!Number.isFinite(diskSizeInMb)) {\n\t\tthrow new TypeError(\n\t\t\t`parameter 'diskSizeInMb' must be finite, but is ${diskSizeInMb}`,\n\t\t);\n\t}\n\n\tif (\n\t\tdiskSizeInMb < MIN_EPHEMERAL_STORAGE_IN_MB ||\n\t\tdiskSizeInMb > MAX_EPHEMERAL_STORAGE_IN_MB\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`parameter 'diskSizeInMb' must be between ${MIN_EPHEMERAL_STORAGE_IN_MB} and ${MAX_EPHEMERAL_STORAGE_IN_MB}, but got ${diskSizeInMb}`,\n\t\t);\n\t}\n\n\tif (diskSizeInMb % 1 !== 0) {\n\t\tthrow new TypeError(\n\t\t\t`parameter 'diskSizeInMb' must be an integer but got ${diskSizeInMb}`,\n\t\t);\n\t}\n};\n","sourceCodeStart":15,"sourceCodeEnd":38,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/validate-disk-size-in-mb.ts#L15-L38","documentation":"Final guard in validateDiskSizeInMb: the value must be an integer (diskSizeInMb % 1 === 0). Fractional MB values are rejected because AWS Lambda ephemeral storage only accepts whole-megabyte increments.","triggerScenarios":"Calling validateDiskSizeInMb with a finite, in-range but fractional number such as 2048.5 or 512.1.","commonSituations":"Computing disk size by multiplying a ratio (e.g., 1024 * 1.5 = 1536 is fine, but 1024 * 1.55 = 1587.2 is not); dividing storage into proportions; floating-point arithmetic producing small fractional remainders.","solutions":["Round to the nearest integer with Math.round() before calling.","Always specify disk size as an integer literal in config.","Use Math.ceil() if you want to guarantee at least the computed capacity."],"exampleFix":"// before\nvalidateDiskSizeInMb(1024 * 1.55); // 1587.2 -> throws\n\n// after\nvalidateDiskSizeInMb(Math.ceil(1024 * 1.55)); // 1588","handlingStrategy":"validation","validationCode":"if (!Number.isInteger(diskSizeInMb)) {\n  diskSizeInMb = Math.ceil(diskSizeInMb);\n}\nvalidateDiskSizeInMb(diskSizeInMb);","typeGuard":"const isIntegerNumber = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isInteger(v);","tryCatchPattern":null,"preventionTips":["Round computed disk sizes with Math.round/Math.ceil before validation.","Specify disk size as integer literals in config.","Avoid ratio arithmetic that yields fractional MB values."],"tags":["input-validation","disk","integer","lambda"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}