Happening with me too since one day. Tried restarting, didn't fix the problem. There is an app on play store called sensor Box for Android. Tested with that and it shows no hardware detected for Orientation, Accelerometer, Gyroscope and Magnetic. My previous phone although cheap shows hardware for all those things.
I think since the gyro sensor is not working, the stock camera app is also malfunctioning in flipping the camera. The camera flips to 180 to front but since gyro is not working it thinks it is in same position as before and gives Camera cannot flip even after it flips.
@madeesh.kannan Can you also check your camera app and tell if you are getting any similar behaviour when flipping to front.