Throw friendlier error when a reference cannot be found.