{"record":{"id":"1768e908ee2468af","repo":"remotion-dev/remotion","slug":"parameter-durationinmilliseconds-must-be-over-0","errorCode":null,"errorMessage":"Parameter 'durationInMilliseconds' must be over 0 but it is ${durationInMilliseconds}.","messagePattern":"Parameter 'durationInMilliseconds' must be over 0 but it is (.+?)\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/estimate-price.ts","lineNumber":65,"sourceCode":"\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(\n\t\t\t`Parameter 'durationInMilliseconds' must be over 0 but it is ${durationInMilliseconds}.`,\n\t\t);\n\t}\n\n\tconst durationPrice = pricing[region]['Lambda Duration-ARM'].price;\n\n\t// In GB-second\n\tconst timeCostDollars =\n\t\tNumber(durationPrice) *\n\t\t((memorySizeInMb * durationInMilliseconds) / 1000 / 1024);\n\n\tconst diskSizePrice = pricing[region]['Lambda Storage-Duration-ARM'].price;\n\n\tconst chargedDiskSize = Math.max(\n\t\t0,\n\t\tdiskSizeInMb - MIN_EPHEMERAL_STORAGE_IN_MB,\n\t);\n\t// In GB-second","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/estimate-price.ts#L47-L83","documentation":"Final guard in the estimatePrice validation chain: durationInMilliseconds < 0 throws a TypeError. A negative duration is nonsensical for a price estimate.","triggerScenarios":"durationInMilliseconds is a finite number but negative (e.g. a clock skew or a subtraction that went below zero).","commonSituations":"Negative duration from end-start math with reversed operands, bad default value of -1, sign error.","solutions":["Clamp durationInMilliseconds to >= 0 (Math.max(0, value)) before calling","Fix the upstream subtraction that produced a negative duration"],"exampleFix":"// before\nconst durationInMilliseconds = end - start; // reversed -> negative\n\n// after\nconst durationInMilliseconds = Math.max(0, start - end);","handlingStrategy":"validation","validationCode":"const durationInMilliseconds = Math.max(0, start - end);","typeGuard":"const isDuration = (v: unknown): v is number => typeof v === 'number' && !Number.isNaN(v) && Number.isFinite(v) && v >= 0;","tryCatchPattern":null,"preventionTips":["Compute durations as (start - end) with the correct operand order","Default missing durations to 0 rather than a sentinel like -1"],"tags":["typescript","validation","api","range"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}