Add back serialize() calls for internal errors

For a value of the incorrect type, the type in question is a
relevant part of the error message.

Follows-up Ie0271de755a63fcda8a3671cc115af7bc931a02b.

Change-Id: I09d9f1975bdfabffe44a6f69b5296cdcbf03a51e