The Occultation

if there's any mention of ghaybat as-saghir and ghaybat al-kabir of the 12th Imam, where the writing of the report predates the period of ghaybat as-saghir for the 12th?

The later Imams (a.s) often did not explicitly specify who al-Qaim (a.j) will be, in order to protect him (a.j). Several failed uprisings by the Zaidis seem to show this was the right path to take. If the Abbasids had discovered the identity of al-Qaim (a.j) they would surely have killed him. In fact, the Abbasids believed al-Qaim's (a.j) uprising would be against them. The spread of narrations about al-Qaim (a.j) caused the Abbasids to fear the Imams. Thus the Abbasids used to discriminate against the Imams (a.s) and restrict their movements and their followers movements. Imam al-Askari (a.s) lived his life under house arrest, and had to report twice a week to the Abbasid court, due to the narrations that the twelfth Imam would be al-Qaim. Indeed, this is one of the reasons for al-Mahdi's (a.j) secretive birth.

Even the Abbasids believed al-Qaim (a.j) will be the son of Imam al-Askari (a.s). To the point that immediately after Imam al-Askari's (a.s) death, al-Mu'tamid al-Abbasi sent men to seal off his house and search within it for his (a.s) son, even sending women to examine his servants and slave-girls to see if they were pregnant.

There are Hadith from the eighth Imam (a.s) stating that al-Qaim's (a.j) body will not be seen and his (a.j) name will not be revealed.

Abu Hashim al-Jafari, a companion of Imam al-Hadi (a.s) narrates from the Imam (a.s):

"The successor after me is my son al-Hasan but what will you do with the successor of my successor?" Al-Ja’fari said, "May Allah make me your sacrifice! Why?" The Imam said, "Because you will not see his physical body and it is not permissible for you to reveal his name." Al-Ja’fari said, "How shall we mention him?" Al-Hadi said, "Say ‘The proof [al-Hujja] from the family of Muhammad.'"

Sheikh as-Saduq's Kama’l al-Di'n wa Tamam al-Ni’ma contains many hadith about al-Qaim (a.j). Sheikh as-Saduq lived during the time of ghaybat as-saghir, however he narrates from Usuli sources before the ghayba.

There are a number of hadith regarding the twelfth Imam (a.j) and his ghayba in Kitab Sulaym ibn Qays. Sulaym was a companion of the first five Imams (a.s), and his book is widely considered to be the first Shi'i collection of Hadith; in fact many consider it to be the oldest surviving Shi'i book. It was written in the first Islamic century. It is considered to be authentic and reliable. In fact it has reportedly been endorsed by several Imams (a.s). For example, Imam as-Saadiq (a.s) has reportedly said (al Mustadrak al Wasail, hadith number 21397):

"The ones from our Shiites and those that loves us, who does not have Kitab (Book of) Sulaym Bin Qays al-Hilali, then there is nothing with him from our matters, nor does he know anything from our reasons, and it is the Alphabet (Abjad) of the Shiites, and a secret from the secrets of the Progeny of Mohammed."

(Unrelated, but Sulaym's book also contains a number of hadith regarding Saqifa).

If you read through the entire book I linked, the author goes through these things and cites early books that mention the 12th Imam (a.j) and the ghayba.

/r/shia Thread Parent