{"record":{"id":"76d4c2a4a1331a36","repo":"remotion-dev/remotion","slug":"maxretries-is-nan","errorCode":null,"errorMessage":"maxRetries is NaN","messagePattern":"maxRetries is NaN","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/cloudrun/src/shared/validate-retries.ts","lineNumber":15,"sourceCode":"export function validateMaxRetries(\n\tmaxRetries: unknown,\n): asserts maxRetries is number {\n\tif (typeof maxRetries !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t'maxRetries must be a number, but is ' + JSON.stringify(maxRetries),\n\t\t);\n\t}\n\n\tif (!Number.isFinite(maxRetries)) {\n\t\tthrow new TypeError('maxRetries must be finite, but is ' + maxRetries);\n\t}\n\n\tif (Number.isNaN(maxRetries)) {\n\t\tthrow new TypeError('maxRetries is NaN');\n\t}\n\n\tif (maxRetries < 0) {\n\t\tthrow new TypeError(`maxRetries cannot be negative but is ${maxRetries}`);\n\t}\n\n\tif (maxRetries % 1 !== 0) {\n\t\tthrow new TypeError(\n\t\t\t`maxRetries should be an integer, but is ${maxRetries}.`,\n\t\t);\n\t}\n}\n","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cloudrun/src/shared/validate-retries.ts#L1-L28","documentation":"Intended to be thrown by validateMaxRetries() when maxRetries is NaN. In practice this branch is effectively unreachable: the preceding Number.isFinite() check (line 10) is also false for NaN, so a NaN value is caught first by the 'must be finite' error at line 11 which reports 'must be finite, but is NaN'. If you ever see the literal text 'maxRetries is NaN', the validator's check order has changed.","triggerScenarios":"Passing NaN as maxRetries (e.g. Number(undefined) or Number('abc')). In the current code path the observable error is the 'must be finite' message, not this one.","commonSituations":"Empty or non-numeric user input coerced with Number(); arithmetic on undefined values; defaulting that accidentally yields NaN.","solutions":["Guard the input with Number.isFinite() before calling the API, which also rejects NaN.","Provide an explicit numeric default whenever the source value is optional or untrusted.","If you need to distinguish NaN specifically, check Number.isNaN() in your own layer first."],"exampleFix":"// before\nrenderMediaOnCloudRun({ ...opts, maxRetries: Number(input.retries) });\n\n// after\nconst parsed = Number(input.retries);\nconst maxRetries = Number.isFinite(parsed) ? parsed : 1;\nrenderMediaOnCloudRun({ ...opts, maxRetries });","handlingStrategy":"validation","validationCode":"if (typeof maxRetries === 'number' && Number.isNaN(maxRetries)) {\n  throw new TypeError('maxRetries is NaN');\n}","typeGuard":"const isNonNaNNumber = (v: unknown): v is number =>\n  typeof v === 'number' && !Number.isNaN(v);","tryCatchPattern":null,"preventionTips":["Use Number.isFinite() upstream - it rejects NaN, Infinity, and non-numbers in one check.","Do not call Number() on empty or non-numeric strings without a fallback.","Note: in the current validator order NaN is actually caught by the 'must be finite' guard first."],"tags":["cloudrun","validation","numeric","unreachable"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}