Improve error message when resource cannot be looked up