Praise be to Allah
At-Tirmidhi (2167) narrated from Ibn ‘Umar (may Allah be pleased with him) that the Messenger of Allah (blessings and peace of Allah be upon him) said: “Allah will not cause my ummah to agree on falsehood; the hand of Allah is with the jamaa‘ah (the main body of the Muslims).” Classed as hasan by al-Albaani.
The meaning of this hadith is that Allah has protected the scholars of the ummah of Muhammad (blessings and peace of Allah be upon him) from unanimously agreeing upon something false.
This protection is only for all the scholars of the ummah during any given period. As for the agreement of some of them or most of them on something, that is not protected from error.
Similarly, if the common folk are agreed on some matter, that does not indicate that it is true, because what matters here is the scholars, not the common folk or the ignorant.
Abu ‘Eesa at-Tirmidhi said in his Sunan: What is meant by the jamaa‘ah (the main body of the Muslims), according to the scholars, is the scholars of fiqh, knowledge and hadith.
Al-Mulla ‘Ali al-Qaari said: The hadith indicates that if the Muslims unanimously agree on something, then it must be true, and what is meant is the unanimous agreement of the scholars. The consensus of the common folk does not carry any weight, because it is not based on knowledge.
End quote from Mirqaat al-Mafaateeh (2/61)
Ash-Shaatibi said: There is no difference of opinion concerning the fact that the agreement of the common folk is of no significance.
End quote from al-I‘tisaam (1/354)
The fact that there are many who follow one of the jamaa‘ahs, groups or sects is not an indication that they are following truth. The Christians are greater in number than the Muslims, and the followers of innovation and misguidance are more numerous than Ahl as-Sunnah in some countries, but does that mean that they are following truth?!
Abu Shaamah al-Maqdisi (may Allah have mercy on him) said: When there is a command to adhere to the jamaa‘ah (the main body of the Muslims), what is meant is adhering to the truth and following it, even if those who adhere to the truth are few and those who go against it are many, because the truth is that which is followed by the early group, the Prophet (blessings and peace of Allah be upon him) and his Companions (may Allah be pleased with them), and no attention should be paid to the large numbers of those who followed falsehood after their time.
End quote from al-Baa‘ith ‘ala Inkaar al-Bida‘ wa’l-Hawaadith (p. 22)
One of the ways in which Allah deals with His creation is that the followers of truth are few in comparison to the followers of falsehood. Allah, may He be exalted, says (interpretation of the meaning):
“And most of mankind will not believe even if you desire it eagerly”
“Verily, it is the truth from your Lord, but most of mankind believe not”
“And if you obey most of those on earth, they will mislead you far away from Allah’s Path”
Shaykh as-Sa‘di said: This verse indicates that the number of followers is no indicator of truth, and that scarcity of followers does not signal that something is not truth. Rather reality is something other than that, for the people of truth are the fewest in number, but are the greatest in esteem and reward before Allah. Rather we must determine what is true and what is false on the basis of proof and evidence.
End quote from Tafseer as-Sa‘di (1/270)
So what is true and right is known from its being in accordance with the Book of Allah and the Sunnah of His Messenger (blessings and peace of Allah be upon him), and with what the early generations of this ummah were agreed upon, not from large numbers of those who say it.
Al-Fudayl ibn ‘Iyaad (may Allah have mercy on him) said: Adhere to the path of guidance, and do not be affected by the small numbers of those who follow the path. Beware of the paths of misguidance, and do not be deceived by the large numbers of those who are doomed (by following them).
End quote. See: al-Adhkaar by an-Nawawi (p. 221); al-I‘tisaam by ash-Shaatibi (1/83)
And Allah knows best.