I had the same issue.
<<<< FigCaptureSessionRemote >>>> Fig assert: "err == 0 " at bail (FigCaptureSessionRemote.m:866) - (err=-12784)
The problem was that, just like in your code, setting the orientation at the time of capture was the cause. This value should not be set at capture time; instead, it changes with device orientation. By monitoring the AVCaptureDevice.RotationCoordinator’s videoRotationAngleForHorizonLevelCapture property and updating the value accordingly, I was able to resolve the issue.
The Apple sample code AVCam is a useful reference for this.
https://developer.apple.com/documentation/avfoundation/capture_setup/avcam_building_a_camera_app