Al Salamu 'Alaykum.
WHEN A HADITH IS SAHIH, THEN IT IS MY MADHHAB.
Imam Nawawi said in Sharh al Muhaddhab:
It is narrated from Al Shafi’i that he said:
“When you find in my book (anything) contrary to the Sunnah of Allah’s Messenger (saws), then accept the Sunnah of Allah’s Messenger (saws) and leave my opinion.”
And it was narrated from him, “When a hadith is sahih contrary to my opinion, act upon the Hadith and leave my opinion,” or he said, “Then it is my madhhab”. The purport of this has been narrated with different wordings. 1:104.
Our (Shafi’i) companions have acted on this in the issue of tathwib and the condition of being released from ihram due to the excuse of illness and other (issues) besides this which are known in the books of the madhhab. The meaning of what Shafi’i said is not that everyone who sees a sahih Hadith can say, “This is the madhhab of Al Shafi’i and act on its outward (meaning). This is only for those who have reached the rank of ijtihad in the madhhab, the description of which has proceeded or close to it. It is (also) a condition that it dominates his mind that Al Shafi’i did not come across this Hadith or did not know its authenticity and this is only (possible) after studying all the books of Shafi’i and the likes of them from the books of his companions who took from him and what resembles them. This is a difficult condition and rarely does one acquire this (qualification). We only mentioned this condition because Al Shafi’i avoided acting on the outward of many hadiths which he saw and knew but a proof was erected before him invalidating it or abrogating it or specifying or interpreting it etc,
Shaykh Abu ‘Amr said: Acting on the outward of what Al Shafi’i said is not easy so it is not permissible for every jurist to independently act on what he believes is proof from Hadith. From those who trod this path from the Shafi’is in acting on a Hadith which Shafi’i left deliberately although he knew its authenticity due to an obstacle which he comprehended and was hidden from others, is Abu’l Walid Musa ibn Abi’l Jarud of those who accompanied Shafi’i who said, “The cupper and the cupped have broken the fast” is sahih so I say, “Al Shafi’s opinion is that the cupper and the cupped have broken the fast,” and this was not accepted from Abul Walid because Shafi’i left it though he knew it is authentic because it was abrogated according to him. Al Shafi’i clarified its abrogation and adduced proof against it and you will see this in Kitab al Siyam if Allah wills.
Shaykh Abu ‘Amr said: “Whoever from the Shafi’is finds a Hadith contradicting his madhhab, it will be deliberated; If the tools of ijtihad are perfected in him, absolutely or in this particular subject or issue, he will have complete independence in acting on it; and if it is not perfected and if it is difficult for him to oppose that Hadith after he researched , and he did not find a satisfactory answer contrary to it, he may act upon it if an independent Imam besides al Shafi’ acted upon it and this will be an excuse for him to leave the madhhab of his Imam at this point.” What he said is excellent and stipulated. Allah knows Best. 1:104-6.
I say: This is exactly what we mentioned before in refutation of Ibn al Qayyim.
In Radd al Muhtar, (Ibn ‘Abidin) narrated from ‘Allama al Biri from Sharh al Hidaya from Ibn Shahnah, “’When a Hadith is Sahih, it is my madhhab.’ Ibn ‘Abd al Barr related this from Abu Hanifa and other Imams and Imam al Sha’rani also transmitted this from the four Imams. It is not hidden that this is for one qualified to examine the texts and has knowledge of its non-abrogated from its abrogated, so when the scholars of the madhhab deliberate on an evidence and act upon it, its attribution to the madhhab is sound due to it issuing by permission from the founder of the madhhab, since there is no doubt that if he knew the weakness of his proof, he would go back on it and follow the stronger proof. For this the verifier (ibn al Humam) refuted some scholars when they issued fatwa according to the opinions of the two Imams (Abu Yusuf and Muhammad) because the opinion of the Imam is not rejected except when his evidence is weak.”
Al Din al Qayyim, pg 92-93.