{"record":{"id":"ac2ad4ac492c1394","repo":"remotion-dev/remotion","slug":"parameter-memorysizeinmb-must-be-an-integer-but","errorCode":null,"errorMessage":"parameter 'memorySizeInMb' must be an integer but got ${memorySizeInMb}","messagePattern":"parameter 'memorySizeInMb' must be an integer but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/validate-memory-size.ts","lineNumber":27,"sourceCode":"\n\tif (Number.isNaN(memorySizeInMb)) {\n\t\tthrow new TypeError(`parameter 'memorySizeInMb' must not be NaN, but is`);\n\t}\n\n\tif (!Number.isFinite(memorySizeInMb)) {\n\t\tthrow new TypeError(\n\t\t\t`parameter 'memorySizeInMb' must be finite, but is ${memorySizeInMb}`,\n\t\t);\n\t}\n\n\tif (memorySizeInMb < MIN_MEMORY || memorySizeInMb > MAX_MEMORY) {\n\t\tthrow new TypeError(\n\t\t\t`parameter 'memorySizeInMb' must be between ${MIN_MEMORY} and ${MAX_MEMORY}, but got ${memorySizeInMb}`,\n\t\t);\n\t}\n\n\tif (memorySizeInMb % 1 !== 0) {\n\t\tthrow new TypeError(\n\t\t\t`parameter 'memorySizeInMb' must be an integer but got ${memorySizeInMb}`,\n\t\t);\n\t}\n};\n","sourceCodeStart":9,"sourceCodeEnd":32,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/validate-memory-size.ts#L9-L32","documentation":"Thrown by validateMemorySize() when memorySizeInMb is a finite number inside [512, 10240] but has a fractional part. AWS Lambda memory must be allocated in whole-megabyte increments; the function uses `value % 1 !== 0` to detect non-integers.","triggerScenarios":"Passing a memory value computed from a division or average, e.g. memorySizeInMb: 2048.5, or accepting a decimal from a config file / UI slider without rounding.","commonSituations":"A cost-optimization script that computes memory = budget / lambdaCount and forwards the raw float; parsing a value with parseFloat that yields a decimal.","solutions":["Round the value before passing it: Math.round(memorySizeInMb).","Coerce with Math.floor or Math.ceil and then clamp into [512, 10240].","If the decimal came from a formula, audit the formula and decide on a rounding policy."],"exampleFix":"// before\nconst memorySizeInMb = totalBudget / lambdaCount; // 2048.5\nawait renderMediaOnLambda({memorySizeInMb, ...});\n\n// after\nconst memorySizeInMb = Math.round(totalBudget / lambdaCount);\nawait renderMediaOnLambda({memorySizeInMb, ...});","handlingStrategy":"validation","validationCode":"const memorySizeInMb = Math.round(Number(raw));\nawait renderMediaOnLambda({memorySizeInMb, ...});","typeGuard":"const isIntegerMemory = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v % 1 === 0 && v >= 512 && v <= 10240;","tryCatchPattern":null,"preventionTips":["Always round memory values derived from a formula before passing them in.","Prefer integer-only inputs in your config schema (zod .int(), JSON schema type integer).","Add an assertion at the config loader so the failure happens at boot, not mid-render."],"tags":["lambda","validation","typescript","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}