It happens when the camera app is closed to quickly (independent whether the phone is locked or unlocked). Then images are not saved but only the empty file is created.
When opening the camera app again. It is often stuck and can’t access the camera hardware. Then I need to close and reopen the camera app.