Throw error if file data is invalid.