In Chapter 29 of the Qur'an, named as "The Spider", God invokes the stories of seven prior prophets and their nations to illustrate that testing people and subjecting them to trials is a divine custom which also applied to these nations. God tried and tested them; some were saved and others perished because they had taken up guardians beside God.
After narrating the stories of these past nations, God then strikes a parable for these nations having taken up guardians beside Him. Through the parable, it becomes clear that what they had taken and built is the frailest of structures. The parable is that of the spider. The verse from which the name of the Chapter is given is verse 43:
The parable of those who take guardians instead of Allah is that of the spider that takes a home, and indeed the frailest of homes is the home of a spider, had they known!
Tafsir al-Mizan says that there are two concerns in the above verse:
1. Taking guardians beside God
2. Taking a home
The underlying meaning here is that the quality of the idolaters when they take-up guardians besides God is the same as the quality of a spider when it takes a home. The author says that the clause, indeed the frailest of homes is the home of a spider, elucidate the quality of the house which the spider has taken. Notice that God does not say: "and indeed the spider has the frailest of homes". This is because grammatically, it was appropriate to say and indeed the frailest of homes is the home of a spider in keeping with the intent of the proverb without altering it.
The meaning then, is that their taking-up guardians besides God, namely their gods to whom they entrust their affairs, is like a spider taking a home which is the frailest of homes, as it bears no semblance to a home save in its name; it neither repels heat nor cold, nor does it endure or protect its occupant from harm. In the same manner, whatever guardianship (wilāyah) their guardians might have is in the name alone, for they bring neither benefit nor harm, nor do they hold power over life, death or resurrection!
At the end of the exposition of the above verse (29:43), the author says:
The meaning of the verse—taken in its most absolute sense—applies to anyone who takes, in any matter or affair, whatever it may be, a guardian besides God to whom he entrusts his affairs and whom he sees as having some effect which he hopes to obtain, even if he does not consider this guardian an idol. This is unless he sees this guardianship as ultimately falling beneath the umbrella of God’s guardianship, as is the case with the wilāyah of God’s Messenger, the Imams and the faithful in general.
Reference: Al-Mizan, upcoming Eng. Vol. 31 (pub. by Tawheed Institute, 2019).