{"record":{"id":"3304e54fe8c05f14","repo":"remotion-dev/remotion","slug":"unsupported-rotation-rotation","errorCode":null,"errorMessage":"Unsupported rotation: ${rotation}","messagePattern":"Unsupported rotation: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/convert/app/lib/canvas-capture-conversion.ts","lineNumber":111,"sourceCode":"}) => {\n\tconst normalizedRotation = normalizeVideoRotation(rotation);\n\tif (normalizedRotation === 0) {\n\t\treturn {x, y};\n\t}\n\n\tif (normalizedRotation === 90) {\n\t\treturn {x: dimensions.height - y, y: x};\n\t}\n\n\tif (normalizedRotation === 180) {\n\t\treturn {x: dimensions.width - x, y: dimensions.height - y};\n\t}\n\n\tif (normalizedRotation === 270) {\n\t\treturn {x: y, y: dimensions.width - x};\n\t}\n\n\tthrow new Error(`Unsupported rotation: ${rotation}`);\n};\n\nexport const mapCanvasCapturePointToSample = ({\n\tx,\n\ty,\n\tsourceDimensions,\n\trotation,\n\tcrop,\n\tsampleDimensions,\n}: {\n\treadonly x: number;\n\treadonly y: number;\n\treadonly sourceDimensions: Dimensions;\n\treadonly rotation: number;\n\treadonly crop: CropRectangle | null;\n\treadonly sampleDimensions: Dimensions;\n}) => {\n\tconst rotatedPoint = rotateCanvasCapturePoint({","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/convert/app/lib/canvas-capture-conversion.ts#L93-L129","documentation":"Thrown by rotateCanvasCapturePoint when the rotation, after normalization to [0,360), is not one of 0/90/180/270. Canvas-capture conversion only supports orthogonal rotations because it maps pixel coordinates via closed-form transforms for each cardinal angle.","triggerScenarios":"Passing a rotation value that is not a multiple of 90, or a corrupted rotation field from a canvas-capture file. The function checks each cardinal angle in turn and falls through to the throw.","commonSituations":"A canvas-capture manifest carrying an arbitrary-angle rotation; bugs producing NaN/undefined rotation; normalized rotation that lands on 45/17/etc.","solutions":["Snap the rotation to the nearest multiple of 90 before calling rotateCanvasCapturePoint.","Validate rotation ∈ {0,90,180,270} at the source so bad data never reaches this function.","Reject non-orthogonal canvas-capture inputs at ingest."],"exampleFix":"// before\nconst pt = rotateCanvasCapturePoint({x, y, dimensions, rotation});\n\n// after\nconst snapped = Math.round(rotation / 90) * 90;\nif (![0, 90, 180, 270].includes(((snapped % 360) + 360) % 360)) {\n  throw new Error(`Rotation must be a multiple of 90, got ${rotation}`);\n}\nconst pt = rotateCanvasCapturePoint({x, y, dimensions, rotation: snapped});","handlingStrategy":"type-guard","validationCode":"const ALLOWED = new Set([0, 90, 180, 270]);\nconst normalized = ((Math.round(rotation / 90) * 90) % 360 + 360) % 360;\nif (!ALLOWED.has(normalized)) throw new Error(`Rotation must be a multiple of 90, got ${rotation}`);","typeGuard":"function isOrthogonalRotation(r: number): boolean {\n  const n = ((r % 360) + 360) % 360;\n  return n === 0 || n === 90 || n === 180 || n === 270;\n}","tryCatchPattern":"null","preventionTips":["Validate rotation ∈ {0,90,180,270} at ingest for canvas-capture inputs.","Snap arbitrary angles to the nearest cardinal before processing.","Reject manifests with non-orthogonal rotations early."],"tags":["typescript","convert","canvas-capture","rotation","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}