Returning useful error message when sorting on a completion field

Closes #3747