Added more explicit error messages for entity retrieval.