Good or evil is originally found solely in the will.
Our will is guided by the judgment of reason, and what is decisive is not only the distinction between something that is inherently good and what is inherently bad, but also the way that reason understands it.
It is possible that reason out of ignorance accepts as good something that is bad in itself.
In this case, it is a mistake of conscience, which also obliges, but not by itself but by accident.