Sayyiduna Ali (may Allah be pleased with him) narrates: "I heard the Prophet (peace and blessings be upon him) say: 'The pen has been lifted from three (kinds of people): from the child until he attains understanding, from the sleeper until he wakes up, and from the insane person until his illness is removed.' Or he (peace and blessings be upon him) said: '(until) he recovers.'"
Imam al-Tirmidhi (may Allah have mercy on him) narrated it from Muhammad bin Yahya al-Qut'i, from Busr bin Umar, from Hammam, from Qatadah, from al-Hasan, and said: "This hadith is hasan gharib through this chain, and we do not know of al-Hasan (al-Basri) having heard from Sayyiduna Ali (may Allah be pleased with him)."
Imam al-Nasa'i (may Allah have mercy on him) narrated it from Abu Dawud al-Harrani, from Affan, from Hammam; and also from Muhammad bin Abd al-A'la, from Yazid bin Harun, from Yunus, from al-Hasan, from Sayyiduna Ali (may Allah be pleased with him) as his own saying (mawquf), and said: "The narration of Yunus is closer to being correct."
Our (above-mentioned) narration is from Yunus, and it is marfu' (attributed to the Prophet), while it has also been said that Dawud bin al-Zibriqan narrated it through Sa'id from Qatadah, from al-Hasan (may Allah have mercy on him), as marfu'.