Enhanced error message for getClassInstance.