{"record":{"id":"ec962c61992f30f3","repo":"remotion-dev/remotion","slug":"invalid-direction-direction","errorCode":null,"errorMessage":"Invalid direction: ${direction}","messagePattern":"Invalid direction: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/transitions/src/presentations/blur-slide.tsx","lineNumber":181,"sourceCode":"\t);\n\treturn tex;\n};\n\nconst getDirectionVector = (\n\tdirection: BlurSlideDirection,\n): [number, number] => {\n\t// v_uv has its origin in the top-left corner, so +y points down.\n\tswitch (direction) {\n\t\tcase 'from-left':\n\t\t\treturn [1, 0];\n\t\tcase 'from-right':\n\t\t\treturn [-1, 0];\n\t\tcase 'from-top':\n\t\t\treturn [0, 1];\n\t\tcase 'from-bottom':\n\t\t\treturn [0, -1];\n\t\tdefault:\n\t\t\tthrow new Error(`Invalid direction: ${direction}`);\n\t}\n};\n\nconst validateProps = (props: BlurSlideProps) => {\n\tconst direction = props.direction ?? DEFAULT_DIRECTION;\n\tconst blur = props.blur ?? DEFAULT_BLUR;\n\n\tif (!VALID_DIRECTIONS.includes(direction)) {\n\t\tthrow new TypeError(\n\t\t\t`direction passed to blurSlide() must be one of ${VALID_DIRECTIONS.map((d) => `\"${d}\"`).join(', ')}, received ${JSON.stringify(direction)}`,\n\t\t);\n\t}\n\n\tif (typeof blur !== 'number' || !Number.isFinite(blur)) {\n\t\tthrow new TypeError(\n\t\t\t`blur passed to blurSlide() must be a finite number, received ${blur}`,\n\t\t);\n\t}","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/transitions/src/presentations/blur-slide.tsx#L163-L199","documentation":"Internal guard in getDirectionVector: the direction prop value reached the switch statement without matching any known direction. Reaching this throw usually means a direction string outside the union was cast to BlurSlideProps['direction'] at runtime (validateProps is not run on this path).","triggerScenarios":"Passing a direction value like 'from-left ' (typo/whitespace), a dynamically computed string, or an object typed as the union via `as any` into the blurSlide presentation props.","commonSituations":"Props coming from user input, JSON config, or database values where TypeScript's union typing was bypassed; typos like 'top' instead of 'from-top'.","solutions":["Use one of the valid direction literals: 'from-left', 'from-right', 'from-top', 'from-bottom'","Trim/normalize the direction string before passing it","If the value is dynamic, validate it against VALID_DIRECTIONS before assigning","Fix any `as` casts that let invalid strings into the direction prop"],"exampleFix":"// before\n<BlurSlide direction={\"top\" as any} />\n// after\n<BlurSlide direction=\"from-top\" />","handlingStrategy":"validation","validationCode":"const VALID = ['from-left','from-right','from-top','from-bottom'] as const;\nif (!VALID.includes(direction as any)) {\n  throw new Error(`Invalid direction: ${direction}`);\n}","typeGuard":"const isDirection = (d: unknown): d is 'from-left'|'from-right'|'from-top'|'from-bottom' =>\n  ['from-left','from-right','from-top','from-bottom'].includes(d as string);","tryCatchPattern":"try {\n  presentation = blurSlide({direction: userInput as any});\n} catch (err) {\n  if (String(err).startsWith('Invalid direction')) presentation = blurSlide({});\n}","preventionTips":["Never cast arbitrary strings to the direction union type with `as`","Validate UI/config-sourced direction strings against the union first","Use TypeScript strict mode so invalid literals fail compilation","Keep direction values free of whitespace/typos"],"tags":["props","validation","webgl"],"backgroundTag":"invalid-enum-value","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}