"When you tweet something like that out there you don't know what the consequences are going to be, and the consequences could be lives," Panetta said while appearing alongside Pompeo.
"You don't just roll a grenade in the room, have things blow up, then not have a strategy for how the hell you deal with it," Panetta later added.
Pompeo also revealed that he sent a letter to a senior military official in Iran, warning that Iran risked being held responsible if any of its proxy forces in Iraq attacked US troops.
Pompeo said the letter was sent to Iranian Maj. Gen. Qasem Soleimani, commander of the Quds Force, who oversees Iranian operations in Syria and Iraq.
US officials see militias in both countries as being controlled and influenced by Iran via Soleimani, and officials have expressed concern that Tehran might use these proxy forces to attack American personnel.
"He refused to open the letter. It didn't break my heart, to be honest with you," Pompeo said. "What we were communicating to him in that letter was that we will hold he and Iran accountable for any attacks on American interests in Iraq by forces that are under their control."