When checking models, ensure that error message is correctly formatted (#4853)