I see three possibilities for problems. This one maybe being the easiest to avoid. I would not even consider entering a country where there was political unrest or where they were not receptive to Americans. The only means of help might be the American Embassy. But even they have many times proven ineffective in times of war and political strife.
Every country has it's regulations and when in Rome, yada yada yada.
There are entry and exit procedures, clearance and port fees, and laws of the land that must be followed and obeyed. Non compliance with anyone of those could result in not getting an exit permit. The only solution, do it, pay it, get it and go. Now lets talk for a minute about an exit permit. When leaving it is necessary to visit the authorities again and obtain an exit permit.