Will you be excommunicated if through negligence you fail in your obligation to learn the basics about your faith and because of this unknowingly fall into Heresy?
Canon law says this:
Can. 1323 The following are not subject to a penalty when they have violated a law or precept:2/ a person who **without negligence **was ignorant that he or she violated a law or precept; inadvertence and error are equivalent to ignorance;
Can. 1324 §1. The perpetrator of a violation is not exempt from a penalty, but the penalty established by law or precept must be tempered or a penance employed in its place if the delict was committed:9/ by a person who **without negligence **did not know that a penalty was attached to a law or precept;
For issues such as these, a canon lawyer’s your best shot. Alternately, it might be a good question to post in Ask An Apologist.
Law is a specialized languaged, and canon law perhaps moreso.
Here’s the relevant Catechism passage:
1461 Since Christ entrusted to his apostles the ministry of reconciliation,65 bishops who are their successors, and priests, the bishops’ collaborators, continue to exercise this ministry. Indeed bishops and priests, by virtue of the sacrament of Holy Orders, have the power to forgive all sins “in the name of the Father, and of the Son, and of the Holy Spirit.”
1462 Forgiveness of sins brings reconciliation with God, but also with the Church. Since ancient times the bishop, visible head of a particular Church, has thus rightfully been considered to be the one who principally has the power and ministry of reconciliation: he is the moderator of the penitential discipline.66 Priests, his collaborators, exercise it to the extent that they have received the commission either from their bishop (or religious superior) or the Pope, according to the law of the Church.67
1463 **Certain particularly grave sins incur excommunication, the most severe ecclesiastical penalty, which impedes the reception of the sacraments and the exercise of certain ecclesiastical acts, and for which absolution consequently cannot be granted, according to canon law, except by the Pope, the bishop of the place or priests authorized by them. In danger of death any priest, even if deprived of faculties for hearing confessions, can absolve from every sin and excommunication.69 **
1464 Priests must encourage the faithful to come to the sacrament of Penance and must make themselves available to celebrate this sacrament each time Christians reasonably ask for it.70
1465 When he celebrates the sacrament of Penance, the priest is fulfilling the ministry of the Good Shepherd who seeks the lost sheep, of the Good Samaritan who binds up wounds, of the Father who awaits the prodigal son and welcomes him on his return, and of the just and impartial judge whose judgment is both just and merciful. The priest is the sign and the instrument of God’s merciful love for the sinner.
1466 The confessor is not the master of God’s forgiveness, but its servant. The minister of this sacrament should unite himself to the intention and charity of Christ.71 He should have a proven knowledge of Christian behavior, experience of human affairs, respect and sensitivity toward the one who has fallen; he must love the truth, be faithful to the Magisterium of the Church, and lead the penitent with patience toward healing and full maturity. He must pray and do penance for his penitent, entrusting him to the Lord’s mercy.
1467 Given the delicacy and greatness of this ministry and the respect due to persons, the Church declares that every priest who hears confessions is bound under very severe penalties to keep absolute secrecy regarding the sins that his penitents have confessed to him. He can make no use of knowledge that confession gives him about penitents’ lives.72 This secret, which admits of no exceptions, is called the “sacramental seal,” because what the penitent has made known to the priest remains “sealed” by the sacrament.