Usul al-Kafi
Book 4:
The Book of Divine Proof

Chapter 51
Undisclosed knowledge of Imams

399. 1. Imam Muhammad al-Baqir (p) addressing his companions: If you had control of your tongues (i.e., if you could keep to yourself what you know), I would have told everyone what is to their advantage and what is to their disadvantage.

400. 2. Abu Basir asked Imam Jafar as-Sadiq (p): Why did the companions of Imam Ali (p) suffer despite having prior knowledge of their death and the calamities that would befall them.
The Imam (p): It is because they themselves accepted their fate.
Abu Basir: What prevents you (from telling me the future)?
The Imam (p): This door has been closed, except that Imam al-Husayn (p), may the blessings of God be upon him, opened it a little (i.e., he informed his companions on the eve of Ashura of what would befall them). O Abu Muhammad! Indeed they were people who controlled their tongues (that is, they could keep secrets to themselves).