{"record":{"id":"7e7d03e673f726dc","repo":"remotion-dev/remotion","slug":"samples-must-be-1-but-got-json-stringify-r","errorCode":null,"errorMessage":"\"samples\" must be >= 1, but got ${JSON.stringify(r.samples)}","messagePattern":"\"samples\" must be >= 1, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/zoom-blur/index.ts","lineNumber":111,"sourceCode":"\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be an integer, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst validateZoomBlurParams = (params: ZoomBlurParams): void => {\n\tassertEffectParamsObject(params, 'Zoom Blur');\n\tassertOptionalFiniteNumber(params.amount, 'amount');\n\tassertOptionalUvCoordinate(params.center, 'center');\n\tassertOptionalFiniteNumber(params.samples, 'samples');\n\tassertOptionalInteger(params.samples, 'samples');\n\n\tconst r = resolve(params);\n\tvalidateNonNegative(r.amount, 'amount');\n\tvalidateUnitInterval(r.center[0], 'center[0]');\n\tvalidateUnitInterval(r.center[1], 'center[1]');\n\tif (r.samples < 1) {\n\t\tthrow new TypeError(\n\t\t\t`\"samples\" must be >= 1, but got ${JSON.stringify(r.samples)}`,\n\t\t);\n\t}\n\n\tif (r.samples > MAX_SAMPLES) {\n\t\tthrow new TypeError(\n\t\t\t`\"samples\" must be <= ${MAX_SAMPLES}, but got ${JSON.stringify(r.samples)}`,\n\t\t);\n\t}\n};\n\nexport const zoomBlur = createEffect<ZoomBlurParams, ZoomBlurState>({\n\ttype: 'remotion/zoom-blur',\n\tlabel: 'zoomBlur()',\n\tdocumentationLink: 'https://www.remotion.dev/docs/effects/zoom-blur',\n\tbackend: 'webgl2',\n\tcalculateKey: (params) => {\n\t\tconst r = resolve(params);","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/zoom-blur/index.ts#L93-L129","documentation":"After default resolution and type checks, the zoomBlur effect enforces a minimum of 1 on the `samples` parameter. If the resolved samples value is below 1 (including 0 or negative numbers), this TypeError is thrown. This is a range guard on top of the integer check.","triggerScenarios":"Passing `samples: 0`, `samples: -5`, or computing samples from a formula that can reach zero or negative (e.g., `Math.floor(intensity * 0)` when intensity is 0).","commonSituations":"Binding samples to a computed expression involving user-controlled intensity or quality settings that can bottom out at zero, or animating samples with interpolate() and hitting a negative value at the timeline edges.","solutions":["Clamp samples to at least 1: `samples: Math.max(1, computedSamples)`.","Use `interpolate(frame, [...], [1, 64], {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'})` to keep the range valid.","Omit samples to use the default of 24."],"exampleFix":"// before\nzoomBlur({ samples: quality * 0 }); // 0 at low quality\n\n// after\nzoomBlur({ samples: Math.max(1, Math.round(quality * 24)) });","handlingStrategy":"validation","validationCode":"const samples = Math.max(1, Math.round(computedSamples));\nzoomBlur({ samples });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp computed sample values to [1, 64] before passing.","Use interpolate with extrapolateLeft: 'clamp' for animated samples.","Avoid deriving samples from factors that can reach zero."],"tags":["validation","effects","zoom-blur","range-check"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}