1. Question: Why is it forbidden to stoke the coals under the fire of a pot of food that belongs to a non-Jew lest it might have meat and milk mixed in the walls of the pot which you would inadvertently be cooking but you are able to close a chest on Shabbos which might have flies in it and inadvertently trap them on Shabbos which is normally forbidden?
A. Rebbe Akiva Aiger on the Rema in Yoreh Deah 87:6 says that though normally doing something without intent is permissible but that’s only if there is a doubt of whether something will go wrong in the future but in this case the doubt of whether there is meat and milk mixed in the walls of the pot is a question of what happened in the past so if the mixture of meat and milk is there then it is inevitable (psik reisha) that a prohibition of cooking meat and milk together would happen.
B. However, the same holds true for the flies in the chest. If they are there, then it happened already, so it is inevitable that if you lock the chest on Shabbos you will be trapping them, though that is not your intent.
C. Shabbos requires a meleches machsheves, and act of craftmanship, or thought put into it, in order for it to be prohibited.
Answer: If one does not know whether the flies are really in the chest or not then he is lacking meleches machsheves, so even if it is a psik reisha, inevitable, that if the flies would be there, they would be trapped but since you don’t know if they are there and all you are doing is locking the chest then you really aren’t trapping. But whether you intend to cook milk and meat or not by stoking the coals, it is a psik reisha that forbidden cooking would happen if the prohibition is therefore you can’t do it.