In the real world of uncertainty and imperfect knowledge there are no guarantees. The market process ultimately determines the selling price and the market price determines all costs. (Remember the backward reaching effect of derived demand? If not, contact me and I will explain.)
In the end the result may be a profit or it may be a loss. And since production can continue only if it yields positive results (i.e. yielding a profit) there are limits to production. Unequivocally, it must be clearly stated that there is nothing evil about profit. It is what motivates production despite the uncertainty!