{"record":{"id":"269040d5f58c742f","repo":"remotion-dev/remotion","slug":"a-duration-of-a-spring-must-be-positive-but-is","errorCode":null,"errorMessage":"A \"duration\" of a spring must be positive, but is ${dur}","messagePattern":"A \"duration\" of a spring must be positive, but is (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validation-spring-duration.ts","lineNumber":25,"sourceCode":"\t\tthrow new TypeError(\n\t\t\t`A \"duration\" of a spring must be a \"number\" but is \"${typeof dur}\"`,\n\t\t);\n\t}\n\n\tif (Number.isNaN(dur)) {\n\t\tthrow new TypeError(\n\t\t\t'A \"duration\" of a spring is NaN, which it must not be',\n\t\t);\n\t}\n\n\tif (!Number.isFinite(dur)) {\n\t\tthrow new TypeError(\n\t\t\t'A \"duration\" of a spring must be finite, but is ' + dur,\n\t\t);\n\t}\n\n\tif (dur <= 0) {\n\t\tthrow new TypeError(\n\t\t\t'A \"duration\" of a spring must be positive, but is ' + dur,\n\t\t);\n\t}\n};\n","sourceCodeStart":7,"sourceCodeEnd":30,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validation-spring-duration.ts#L7-L30","documentation":"`validateSpringDuration()` requires the optional `duration` (when provided) to be greater than zero. A non-positive duration is meaningless for a spring animation and would produce divide-by-zero or negative-frame outputs.","triggerScenarios":"Passing `duration: 0` or a negative number to `spring()`.","commonSituations":"Default-initializing `duration` to `0`, or computing it from a subtraction that can go negative.","solutions":["Pass a positive number of seconds, e.g. `duration: 1`.","Clamp: `duration: Math.max(0.1, value)`.","Omit `duration` entirely to use the default spring behavior."],"exampleFix":"// before\nspring({frame, fps, config, duration: 0});\n// after\nspring({frame, fps, config, duration: 1});","handlingStrategy":"validation","validationCode":"const duration = Math.max(0.1, Number(rawDuration));","typeGuard":"const isPositiveDuration = (v: unknown): v is number => typeof v === 'number' && v > 0;","tryCatchPattern":null,"preventionTips":["Initialize duration defaults to a positive constant.","Never pass 0 as a placeholder.","Validate at the form boundary before forwarding to springs."],"tags":["validation","spring","animation","numeric"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}