Cave 17 is the world famous Library Cave, discovered by Taoist Wang Yuanlu in 22June, 1900. This south-facing cave lies in the south wall of the corridor of cave 16, about three meters high with a ground size of some 2.8 square meters and a truncated pyramidal ceiling. A rectangle alter is constructed against the north wall on which rests an image of the great monk Hong Bian. A stele with an inscription dated the Dazhong 5th year (851) about Hong Bian is set into the west wall.
Hong Bian is a great monk active during Middle and Late Tang periods. Zhang Yichao had sentsom bhiksus including wuzhen to inform the central government at Chang'an after he reoccupied the Hexi regions, and Hong bianwas appointed Chief of Monks in Hexi and Dean of Shazhou, with the title "High priest to All Altars Inside and Outside the Captial" and granted the right to wear a purple kasaya by the emperor. The sculpture (94cm x 74cm x 60cm) in patched robe looks like a common person bt solemn and natrural with fishtailed folds at the corners of eyes and closed mouth. This image is completely detached from the wall, which did not follow the rule of representing Buddhist images such as the laksana-vyanjana, from this we can infer that it is a portrait, probably made by his disciples after is nirvana.
Based on various materials, scholars have put forward many hypotheses as to when and why the Library cave was sealed up because no reliable materials are available. These hypotheses include opionions suggesting it was to avoid the attack of Western Xia, or was abandoned, or was a reconstruction of the library. The most influential opinions is the first on put forward by Pelliot in1908.He inferred this cave to be sealed up before 1035 based on the fact that latest manuscripts inside date from Song and no Tangut manuscripts are found there.