{"record":{"id":"e29be929585f0aae","repo":"remotion-dev/remotion","slug":"parameter-durationinmilliseconds-must-be-a-numbe","errorCode":null,"errorMessage":"Parameter 'durationInMilliseconds' must be a number but got ${typeof durationInMilliseconds}","messagePattern":"Parameter 'durationInMilliseconds' must be a number but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/estimate-price.ts","lineNumber":47,"sourceCode":" */\nexport const estimatePrice = ({\n\tregion,\n\tmemorySizeInMb,\n\tdiskSizeInMb,\n\tlambdasInvoked,\n\t...other\n}: EstimatePriceInput): number => {\n\tvalidateMemorySize(memorySizeInMb);\n\tvalidateAwsRegion(region);\n\tvalidateDiskSizeInMb(diskSizeInMb);\n\n\tconst durationInMilliseconds =\n\t\t'durationInMiliseconds' in other\n\t\t\t? other.durationInMiliseconds\n\t\t\t: other.durationInMilliseconds;\n\n\tif (typeof durationInMilliseconds !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Parameter 'durationInMilliseconds' must be a number but got ${typeof durationInMilliseconds}`,\n\t\t);\n\t}\n\n\tif (Number.isNaN(durationInMilliseconds)) {\n\t\tthrow new TypeError(\n\t\t\t`Parameter 'durationInMilliseconds' must not be NaN but it is.`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(durationInMilliseconds)) {\n\t\tthrow new TypeError(\n\t\t\t`Parameter 'durationInMilliseconds' must be finite but it is ${durationInMilliseconds}`,\n\t\t);\n\t}\n\n\tif (durationInMilliseconds < 0) {\n\t\tthrow new TypeError(","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/estimate-price.ts#L29-L65","documentation":"estimatePrice runs a typeof check on the resolved durationInMilliseconds and throws a TypeError if it is not a number. The function accepts both the deprecated typo key durationInMiliseconds and the correct durationInMilliseconds, so a non-number usually means neither key was supplied (undefined) or a string/other type was passed.","triggerScenarios":"Calling estimatePrice with no durationInMilliseconds (and no durationInMiliseconds), or with a non-numeric value such as a string.","commonSituations":"Object spread that dropped the field, renamed prop without updating call site, passing a string from user input.","solutions":["Pass durationInMilliseconds as a number","If using the deprecated durationInMiliseconds typo, rename it to durationInMilliseconds","Coerce/Number() only after confirming the source value is numeric"],"exampleFix":"// before\nestimatePrice({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked });\n\n// after\nestimatePrice({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, durationInMilliseconds: 5000 });","handlingStrategy":"validation","validationCode":"function assertDuration(v: unknown): asserts v is number {\n  if (typeof v !== 'number') {\n    throw new TypeError('durationInMilliseconds must be a number');\n  }\n}","typeGuard":"const isDuration = (v: unknown): v is number => typeof v === 'number' && !Number.isNaN(v) && Number.isFinite(v) && v >= 0;","tryCatchPattern":null,"preventionTips":["Type the call site strictly so omitted durationInMilliseconds is a compile error","Migrate any durationInMiliseconds (typo) usages to durationInMilliseconds","Validate at the boundary where user input enters"],"tags":["typescript","validation","api","typeof"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}