{"record":{"id":"4d39e48afad18abd","repo":"remotion-dev/remotion","slug":"direction-must-be-horizontal-or-vertical-bu-4d39e4","errorCode":null,"errorMessage":"\"direction\" must be \"horizontal\" or \"vertical\", but got ${JSON.stringify(params.direction)}","messagePattern":"\"direction\" must be \"horizontal\" or \"vertical\", but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/wave/index.ts","lineNumber":96,"sourceCode":"\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tassertRequiredFiniteNumber(value, name);\n};\n\nconst validateWaveParams = (params: WaveParams): void => {\n\tassertEffectParamsObject(params, 'Wave');\n\tassertOptionalFiniteNumber(params.phase, 'phase');\n\tassertOptionalFiniteNumber(params.amplitude, 'amplitude');\n\tassertOptionalFiniteNumber(params.wavelength, 'wavelength');\n\n\tif (\n\t\tparams.direction !== undefined &&\n\t\tparams.direction !== 'horizontal' &&\n\t\tparams.direction !== 'vertical'\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`\"direction\" must be \"horizontal\" or \"vertical\", but got ${JSON.stringify(params.direction)}`,\n\t\t);\n\t}\n\n\tconst resolved = resolve(params);\n\tif (resolved.amplitude < 0) {\n\t\tthrow new TypeError(\n\t\t\t`\"amplitude\" must be >= 0, but got ${JSON.stringify(resolved.amplitude)}`,\n\t\t);\n\t}\n\n\tif (resolved.wavelength <= 0) {\n\t\tthrow new TypeError(\n\t\t\t`\"wavelength\" must be > 0, but got ${JSON.stringify(resolved.wavelength)}`,\n\t\t);\n\t}\n};\n","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/wave/index.ts#L78-L114","documentation":"TypeError thrown by wave's validateWaveParams when params.direction is defined but is neither 'horizontal' nor 'vertical'. Validation runs synchronously when wave() is called; the offending value is echoed via JSON.stringify. direction is optional, so undefined is accepted and defaults to 'horizontal'.","triggerScenarios":"Calling wave({direction: 'Horizontal'}) (wrong case), wave({direction: 'h'}), wave({direction: 'diagonal'}), wave({direction: 0}), or passing a variable that holds an unexpected value. The check is skipped only when direction is undefined.","commonSituations":"Case typos; shorthand values ('h'/'v'); data-driven direction from an API/config without validation; copying a direction name from another effect library.","solutions":["Use exactly 'horizontal' or 'vertical', or omit direction to use the default.","If the value is dynamic, validate it against ['horizontal','vertical'] before passing it.","Type direction as the WaveDirection union so the compiler rejects invalid literals.","Search the codebase for the misspelled value and fix it at the source."],"exampleFix":"// before\nimport {wave} from '@remotion/effects';\n\nconst e = wave({direction: 'diagonal', amplitude: 60}); // throws TypeError\n\n// after\nconst e = wave({direction: 'horizontal', amplitude: 60});\n// or omit for the default\nconst e2 = wave({amplitude: 60});","handlingStrategy":"validation","validationCode":"import {wave} from '@remotion/effects';\n\nconst WAVE_DIRECTIONS = ['horizontal', 'vertical'] as const;\ntype WaveDirection = (typeof WAVE_DIRECTIONS)[number];\n\nconst assertDirection = (direction: unknown): WaveDirection | undefined => {\n  if (direction === undefined) return undefined;\n  if (!WAVE_DIRECTIONS.includes(direction as WaveDirection)) {\n    throw new TypeError(`direction must be one of ${WAVE_DIRECTIONS.join('|')}, got ${JSON.stringify(direction)}`);\n  }\n  return direction as WaveDirection;\n};\n\nconst direction = assertDirection(config.direction);\nconst e = wave({direction, amplitude: 60});","typeGuard":"const WAVE_DIRECTIONS = ['horizontal', 'vertical'] as const;\ntype WaveDirection = (typeof WAVE_DIRECTIONS)[number];\nconst isWaveDirection = (v: unknown): v is WaveDirection =>\n  typeof v === 'string' && (WAVE_DIRECTIONS as readonly string[]).includes(v);","tryCatchPattern":"try {\n  const e = wave({direction: config.direction, amplitude: 60});\n} catch (err) {\n  if (err instanceof TypeError) {\n    console.error('Invalid wave direction:', config.direction, err);\n  }\n  throw err;\n}","preventionTips":["Type direction as the literal union 'horizontal' | 'vertical'.","Validate dynamic/API-supplied direction against the allowed set before calling wave().","Avoid shorthand ('h'/'v') and free-form user input without a whitelist.","Run typecheck in CI to catch misspelled literals."],"tags":["validation","params","wave","typescript"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}