{"record":{"id":"7c624008ecfd1942","repo":"remotion-dev/remotion","slug":"parameter-disksizeinmb-must-be-a-number-got-a","errorCode":null,"errorMessage":"parameter 'diskSizeInMb' must be a number, got a ${typeof diskSizeInMb}","messagePattern":"parameter 'diskSizeInMb' must be a number, got a (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/validate-disk-size-in-mb.ts","lineNumber":8,"sourceCode":"import {\n\tMAX_EPHEMERAL_STORAGE_IN_MB,\n\tMIN_EPHEMERAL_STORAGE_IN_MB,\n} from './constants';\n\nexport const validateDiskSizeInMb = (diskSizeInMb: unknown) => {\n\tif (typeof diskSizeInMb !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`parameter 'diskSizeInMb' must be a number, got a ${typeof diskSizeInMb}`,\n\t\t);\n\t}\n\n\tif (Number.isNaN(diskSizeInMb)) {\n\t\tthrow new TypeError(`parameter 'diskSizeInMb' must not be NaN, but is`);\n\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) {","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/validate-disk-size-in-mb.ts#L1-L26","documentation":"First guard in validateDiskSizeInMb: the parameter must be of type 'number'. Anything else (string, undefined, null, object) throws a TypeError reporting the actual typeof. Subsequent checks (NaN, finite, range, integer) only run after this passes.","triggerScenarios":"Calling validateDiskSizeInMb (directly or via deployFunction/render APIs that validate disk size) with a non-number value, e.g. a string '2048', undefined, null, or an object.","commonSituations":"Reading diskSizeInMb from env/CLI as a string and passing it uncoerced; defaulting to undefined when no config is provided; JSON config with disk size quoted as a string.","solutions":["Pass diskSizeInMb as a number literal (e.g., 2048).","Coerce string inputs with Number() before calling, after confirming it is parseable.","Fix JSON/env config to provide an unquoted numeric value."],"exampleFix":"// before\nvalidateDiskSizeInMb(process.env.DISK_SIZE); // '2048' (string)\n\n// after\nvalidateDiskSizeInMb(Number(process.env.DISK_SIZE));","handlingStrategy":"type-guard","validationCode":"if (typeof diskSizeInMb !== 'number') {\n  throw new TypeError(`diskSizeInMb must be a number, got ${typeof diskSizeInMb}`);\n}\nvalidateDiskSizeInMb(diskSizeInMb);","typeGuard":"const isNumber = (v: unknown): v is number => typeof v === 'number';","tryCatchPattern":null,"preventionTips":["Type diskSizeInMb as number in all config interfaces.","Coerce string env values with Number() before validation.","Quote-free numeric values in JSON config."],"tags":["input-validation","disk","typescript","type-error"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}