The Beraita towards the end of today’s daf (Yevamot 11b) tells us about a very particular situation where a couple – let’s call them Sara & Yossi – are married, they then divorce, then Sara marries another person but they then divorce or he dies, and then Sara and Yossi remarry.
Significantly, the Torah (see Devarim 24:1-4) forbids such an arrangement, yet though the Torah forbids such a marriage and considers it illegal, it is nevertheless acknowledges that such a marriage takes effect (i.e. it is an illegal yet valid marriage, as opposed to some marriages which are both illegal and invalid).
The question posed by the Beraita is what then happens if Yossi dies without children? In theory, his brother is now obligated to fulfil Yibbum with Sara, or if she, or he, would rather not do so, they would then perform Halitzah. Yet what we learn from the Beraita is that in such a situation where the marriage should not have been performed but is nevertheless a ‘valid’ marriage, Yibbum is rabbinically forbidden and therefore only Halitzah may be done (see aso Rambam, Hilchot Yibum V’Halitzah 6:13).
What we see from here is that there are times when more than one action is technically permissible according to the pure definition of halacha, but for reasons of context or due to conflicting moral or halachic messages, it is rendered impermissible. As such, we learn from here that not everything that is illegal is invalid, and similarly, not everything that is technically permissible is necessarily permitted.