{"record":{"id":"c8119df51da7d433","repo":"remotion-dev/remotion","slug":"direction-must-be-horizontal-or-vertical-bu","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/mirror/index.ts","lineNumber":76,"sourceCode":"\tinvert: boolean;\n};\n\nconst resolve = (p: MirrorParams): MirrorResolved => ({\n\tdirection: p.direction ?? 'horizontal',\n\tposition: p.position ?? 0.5,\n\tinvert: p.invert ?? false,\n});\n\nconst validateMirrorParams = (params: MirrorParams): void => {\n\tassertEffectParamsObject(params, 'Mirror');\n\tassertOptionalFiniteNumber(params.position, 'position');\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\tif (params.invert !== undefined && typeof params.invert !== 'boolean') {\n\t\tthrow new TypeError(\n\t\t\t`\"invert\" must be a boolean, but got ${JSON.stringify(params.invert)}`,\n\t\t);\n\t}\n\n\tconst {position} = resolve(params);\n\tvalidateUnitInterval(position, 'position');\n};\n\nexport const mirror = createEffect<MirrorParams, MirrorState>({\n\ttype: 'dev.remotion.effects.mirror',\n\tlabel: 'mirror()',\n\tdocumentationLink: 'https://www.remotion.dev/docs/effects/mirror',","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/mirror/index.ts#L58-L94","documentation":"Thrown by validateMirrorParams in the Mirror effect when direction is present but is neither 'horizontal' nor 'vertical'. undefined is accepted (defaults to 'horizontal'). This is a hand-written check (not the shared formatEnum helper) so the message hardcodes the two literals.","triggerScenarios":"Calling mirror({ direction: 'diagonal' }), mirror({ direction: 'h' }), mirror({ direction: 0 }), or any value that is not exactly 'horizontal' or 'vertical'. Runs after assertEffectParamsObject and assertOptionalFiniteNumber(position), before the position unit-interval check.","commonSituations":"Typo in the literal; passing a value from untyped/serialized config; confusing direction with a rotation concept (Mirror has no angle prop — use position/invert instead).","solutions":["Use 'horizontal' or 'vertical' (the only MirrorDirection values).","Type the value as MirrorDirection so the compiler rejects bad literals.","Omit direction to use the default 'horizontal'."],"exampleFix":"// before\nmirror({ direction: 'h' })\n\n// after\nmirror({ direction: 'horizontal' })","handlingStrategy":"type-guard","validationCode":"const MIRROR_DIRECTIONS = ['horizontal', 'vertical'] as const;\ntype MirrorDirection = (typeof MIRROR_DIRECTIONS)[number];\nconst isMirrorDirection = (v: unknown): v is MirrorDirection =>\n  typeof v === 'string' && (MIRROR_DIRECTIONS as readonly string[]).includes(v);\n\nmirror({ direction: isMirrorDirection(d) ? d : 'horizontal' });","typeGuard":"const isMirrorDirection = (v: unknown): v is 'horizontal' | 'vertical' =>\n  v === 'horizontal' || v === 'vertical';","tryCatchPattern":null,"preventionTips":["Type direction as MirrorDirection so the compiler rejects invalid literals.","Mirror has no angle/rotation prop; position/invert are the other knobs.","Validate values loaded from untyped JSON before passing them in."],"tags":["validation","mirror-effect","typescript","enum","params"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}