Questions are frequently raised on this site as to whether or not such and such an irregularity voids a sacrament. The CC teaches that certain irregularities make a sacrament void, i.e. invalid. This means that no sacrament actually took place. The CC also teaches that there are less serious irregularities that do not void the sacrament, but violate some rule of church discipline.
Are illicit sacraments, if knowingly and willingly done or participated in, necessarily sinful for those who perform the sacrament and those who receive it?
For example, the CC teaches that a lay person may validly baptize, but under normal circumstances it is illicit for a layperson to do so unless there is a bona fide emergency where the candidate is in immediate danger of death and there is not enough time to find a priest. If a Catholic layperson performs a baptism knowing that there is no emergency and that a priest has not been contacted to perform the baptism or even give permission for a lay baptism, and knows that performing such a baptism without a priest constitutes a valid but illicit sacrament, has he sinned? If so, could it be mortal? If the recipient is an adult and they knew everything the baptizer does about the illicitness of the sacrament but nonetheless go ahead and have the sacrament performed without a priest, have they sinned?
How about other sacraments? If a priest performs a confirmation without the bishop’s permission, has he sinned?
Are there rules that determine when an illicit sacrament is not sinful at all, when it is venially sinful, and when it is mortally sinful? I would guess that a sacrament done in good faith that was actually illicit but was not known to be illicit could never be mortally sinful because it couldn’t possibly have the three elements of mortal sin since there would not be full knowledge.
We are only talking about irregularities that do not void the sacrament.