{"record":{"id":"cef85deceb86e00a","repo":"remotion-dev/remotion","slug":"parameter-memorysizeinmb-must-be-between-min-m","errorCode":null,"errorMessage":"parameter 'memorySizeInMb' must be between ${MIN_MEMORY} and ${MAX_MEMORY}, but got ${memorySizeInMb}","messagePattern":"parameter 'memorySizeInMb' must be between (.+?) and (.+?), but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/validate-memory-size.ts","lineNumber":21,"sourceCode":"export const validateMemorySize = (memorySizeInMb: unknown) => {\n\tif (typeof memorySizeInMb !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`parameter 'memorySizeInMb' must be a number, got a ${typeof memorySizeInMb}`,\n\t\t);\n\t}\n\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":3,"sourceCodeEnd":32,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/validate-memory-size.ts#L3-L32","documentation":"Thrown by validateMemorySize() when memorySizeInMb is a finite number but outside the AWS-supported range of 512 to 10240 MB. Lambda only accepts memory in that band, incremented in 1 MB steps. The error message interpolates the offending value and the legal bounds.","triggerScenarios":"Calling renderMediaOnLambda({memorySizeInMb: 256}) (below the floor), memorySizeInMb: 20480 (above the ceiling), or any value computed from user input that was never clamped.","commonSituations":"Assuming smaller memory saves cost (256 MB is below the minimum Lambda allows for Remotion); hardcoding a value copied from a non-Lambda tutorial; auto-scaling logic that pushes memory beyond 10 GB.","solutions":["Set memorySizeInMb to a value within [512, 10240]; use DEFAULT_MEMORY_SIZE (2048) if unsure.","Clamp user-supplied input: Math.min(Math.max(value, 512), 10240).","If you need more than 10240 MB, you cannot get it from a single Lambda — review framesPerLambda and concurrency instead of raising memory."],"exampleFix":"// before\nawait renderMediaOnLambda({memorySizeInMb: 256, ...});\n\n// after\nawait renderMediaOnLambda({memorySizeInMb: 2048, ...});","handlingStrategy":"validation","validationCode":"const clampMemory = (v: number) => Math.min(Math.max(v, 512), 10240);\nawait renderMediaOnLambda({memorySizeInMb: clampMemory(userMemory), ...});","typeGuard":"const isMemorySize = (v: unknown): v is number =>\n  typeof v === 'number' && v >= 512 && v <= 10240 && v % 1 === 0 && Number.isFinite(v);","tryCatchPattern":null,"preventionTips":["Treat [512, 10240] as a hard contract when surfacing memory settings to users.","Provide a dropdown of preset memory sizes instead of a free-text field.","Document that 10240 MB is the per-Lambda ceiling and that more throughput comes from concurrency, not bigger functions."],"tags":["lambda","validation","aws","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}