gives a proper error message if the specified id does not exist