Merge "Improve error messages when output file is invalid" am: 39298b3598

Change-Id: Ie43c3694dc0397727609220fc48183321401621b