The first problem is that "free trade," as peddled by wingnut commentators, include both unrestricted (and even untaxed cross-border movement of capital, and unrestricted trade in goods. These are two quite distinct policies, but are usually conflated by neolibs, because unrestricted trade in goods is usually - usually, but I think not universally - mutually beneficial. Whereas unrestricted and untaxed movement of capital is much more often a zero- or negative-sum game (but very good for the back pockets of people who pay the salaries of wingnut commentators).
But even unrestricted trade in goods can be problematic. One obvious example being strategic goods: Food, antibiotics, electricity and probably a couple of other things you could mention need to be in really stable supply. If a country is cut off from any of these goods for even a short period of time, it will suffer some very nasty Bad Things.
In those cases, a case can easily be made that security of supply trumps low price, and domestic industries in this sector must be protected - because to put one's faith in foreign suppliers is to hand those foreign suppliers (and the countries in which they are located) a firm grip on your balls.
Another obvious exception to the notion that Ricardian free trade is universally beneficial would be infant industries. Suppose you have a country - La Republica De Los Bananas - that has never produced ball bearings. Sure, it is possible that it might be able to get ball bearings cheaper by buying them abroad than by attempting to start up production at home. But this would be true for virtually any industrial good.
So, if La Republica De Los Bananas wants to industrialise (which quite a lot of non-industrialised countries do), they have to build up a comparative advantage in some industry. And doing that is certainly impossible when you have to slavishly open your markets to competition from established industries abroad.
Which domestic industries to favour, to which extent they are to be favoured and indeed whether to use trade policy to spur industrial development at all are obviously political decisions that have to be made in the context of La Republica De Los Bananas' social and industrial policies, so it's far from obvious that signing away the right to make them is A Good Idea.
- Jake If you only spend 20 minutes of the rest of your life on economics, go spend them here.
Even their sources and authorities, thinking of Ricardo and Locke, preface their remarks on trade with the phrase, "If a country hath a surplus ..."