{"record":{"id":"2ce440ae6c8fa41b","repo":"remotion-dev/remotion","slug":"direction-must-be-formatenum-line-directions","errorCode":null,"errorMessage":"\"direction\" must be ${formatEnum(LINE_DIRECTIONS)}, but got ${JSON.stringify(direction)}","messagePattern":"\"direction\" must be (.+?), but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/lines.ts","lineNumber":205,"sourceCode":"\t\t\t`\"colors\" must be an array with at least 2 colors, but got ${JSON.stringify(colors)}`,\n\t\t);\n\t}\n\n\tfor (let i = 0; i < colors.length; i++) {\n\t\tassertRequiredColor(colors[i], `colors[${i}]`);\n\t}\n};\n\nconst validateDirection = (direction: unknown): void => {\n\tif (direction === undefined) {\n\t\treturn;\n\t}\n\n\tif (\n\t\ttypeof direction !== 'string' ||\n\t\t!LINE_DIRECTIONS.includes(direction as LinesDirection)\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`\"direction\" must be ${formatEnum(LINE_DIRECTIONS)}, but got ${JSON.stringify(direction)}`,\n\t\t);\n\t}\n};\n\nconst validateLinesParams = (params: LinesParams): void => {\n\tassertEffectParamsObject(params, 'Lines');\n\tvalidateColors(params.colors);\n\tvalidateDirection(params.direction);\n\tassertOptionalFiniteNumber(params.thickness, 'thickness');\n\tassertOptionalFiniteNumber(params.gap, 'gap');\n\tassertOptionalFiniteNumber(params.angle, 'angle');\n\tassertOptionalFiniteNumber(params.offset, 'offset');\n\tassertOptionalBoolean(params.maskToSourceAlpha, 'maskToSourceAlpha');\n\n\tconst thickness = params.thickness ?? DEFAULT_THICKNESS;\n\tconst gap = params.gap ?? DEFAULT_GAP;\n\tvalidatePositive(thickness, 'thickness');","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/lines.ts#L187-L223","documentation":"Thrown by validateDirection in the Lines effect when direction is present but is not one of the two allowed literals 'horizontal' or 'vertical'. undefined is accepted (defaults to 'horizontal'). The error message is built dynamically from LINE_DIRECTIONS via formatEnum, so it reads 'must be \"horizontal\" or \"vertical\"'.","triggerScenarios":"Calling lines({ direction: 'diagonal' }), lines({ direction: 'h' }), lines({ direction: 1 }), or any value whose type is not string or whose value is not in the tuple. Note the Lines effect also exposes an angle prop for rotation; direction only chooses stripe axis.","commonSituations":"Using a wrong enum literal, a typo, or passing a value loaded from untyped JSON/serialized config. Confusing direction with the angle prop.","solutions":["Use 'horizontal' or 'vertical' (the only valid LinesDirection values).","If you need diagonal stripes, keep direction as horizontal/vertical and set the angle prop instead.","Type the value as LinesDirection so the compiler rejects bad literals."],"exampleFix":"// before\nlines({ direction: 'diagonal' })\n\n// after\nlines({ direction: 'horizontal', angle: 45 })","handlingStrategy":"type-guard","validationCode":"const LINES_DIRECTIONS = ['horizontal', 'vertical'] as const;\ntype LinesDirection = (typeof LINES_DIRECTIONS)[number];\nconst isLinesDirection = (v: unknown): v is LinesDirection =>\n  typeof v === 'string' && (LINES_DIRECTIONS as readonly string[]).includes(v);\n\nlines({ direction: isLinesDirection(d) ? d : 'horizontal' });","typeGuard":"const isLinesDirection = (v: unknown): v is 'horizontal' | 'vertical' =>\n  v === 'horizontal' || v === 'vertical';","tryCatchPattern":null,"preventionTips":["Type direction as LinesDirection so the compiler rejects invalid literals.","Use angle for rotation; direction only swaps the stripe axis.","Validate values loaded from untyped JSON before passing them in."],"tags":["validation","lines-effect","typescript","enum","params"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}