{"record":{"id":"f580edc42eac2a8f","repo":"remotion-dev/remotion","slug":"origin-must-contain-coordinates-between-0-and-1","errorCode":null,"errorMessage":"\"origin\" must contain coordinates between 0 and 1, but got ${JSON.stringify(r.origin)}","messagePattern":"\"origin\" must contain coordinates between 0 and 1, but got (.+?)","errorType":"validation","errorClass":"RangeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/starburst.ts","lineNumber":146,"sourceCode":"\n\tif (r.smoothness < 0 || r.smoothness > 1) {\n\t\tthrow new RangeError(\n\t\t\t`\"smoothness\" must be between 0 and 1, but got ${r.smoothness}`,\n\t\t);\n\t}\n\n\tif (\n\t\t!Array.isArray(r.origin) ||\n\t\tr.origin.length !== 2 ||\n\t\tr.origin.some((coordinate) => {\n\t\t\treturn typeof coordinate !== 'number' || !Number.isFinite(coordinate);\n\t\t})\n\t) {\n\t\tthrow new TypeError('\"origin\" must be a [number, number] tuple');\n\t}\n\n\tif (r.origin.some((coordinate) => coordinate < 0 || coordinate > 1)) {\n\t\tthrow new RangeError(\n\t\t\t`\"origin\" must contain coordinates between 0 and 1, but got ${JSON.stringify(r.origin)}`,\n\t\t);\n\t}\n\n\tfor (const c of r.colors) {\n\t\tcolorToRgb(c);\n\t}\n};\n\nconst STARBURST_VS = /* glsl */ `#version 300 es\nin vec2 aPos;\nin vec2 aUv;\nout vec2 vUv;\nvoid main() {\n\tvUv = aUv;\n\tgl_Position = vec4(aPos, 0.0, 1.0);\n}\n`;","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/starburst.ts#L128-L164","documentation":"The starburst effect's `origin` coordinates must each fall within the closed interval [0, 1] (UV space). This RangeError is thrown by `validateStarburstEffectParams` after the tuple-shape check passes, when any coordinate is a finite number but lies outside [0, 1]. It fires during `validateParams`, ahead of GPU setup.","triggerScenarios":"Passing `origin` with a coordinate below 0 or above 1 (e.g. `origin: [-0.1, 0.5]`, `origin: [0.5, 1.2]`, `origin: [2, 2]`). Confusing pixel coordinates with UV coordinates is the most common cause.","commonSituations":"Developer assumes origin is in pixels and passes large values like `[320, 180]`; computing origin from mouse/canvas pixel coordinates without normalizing by canvas dimensions; off-by-one in a normalization formula.","solutions":["Convert pixel coordinates to UV: divide x by canvas width and y by canvas height before passing as `origin`.","Use values within [0, 1]; for the default center use `[0.5, 0.5]`.","Clamp computed values with `Math.max(0, Math.min(1, value))` before assignment."],"exampleFix":"// before - using pixel coordinates\nstarburst({rays: 6, colors: ['#f00', '#00f'], origin: [320, 180]});\n// after - normalized to UV\nstarburst({rays: 6, colors: ['#f00', '#00f'], origin: [320/640, 180/360]});","handlingStrategy":"validation","validationCode":"const clampUv = (v: number): number => Math.max(0, Math.min(1, v));\nconst rawOrigin = computeOriginPixels(); // [xPx, yPx]\nconst origin: [number, number] = [\n  clampUv(rawOrigin[0] / canvasWidth),\n  clampUv(rawOrigin[1] / canvasHeight),\n];\nstarburst({rays: 6, colors: ['#f00', '#00f'], origin});","typeGuard":"const isUnitIntervalTuple = (v: readonly [number, number]): boolean =>\n  v.every((c) => c >= 0 && c <= 1);","tryCatchPattern":"try {\n  starburst({...params});\n} catch (e) {\n  if (e instanceof RangeError && /origin.*between 0 and 1/.test(e.message)) {\n    starburst({...params, origin: [0.5, 0.5]});\n  } else throw e;\n}","preventionTips":["Remember origin is in UV space [0,1], not pixels — always normalize by canvas dimensions.","Clamp any computed coordinate into [0,1] with `Math.max(0, Math.min(1, v))` before assignment.","Default to `[0.5, 0.5]` (center) unless a specific off-center ray source is required."],"tags":["starburst","validation","params","origin","range","uv"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}