What does Roman Catholic law say about a marriage that was later discovered to be invalid?
This question about a polygamist who converts made me wonder about a different question. According to the Roman Catholic church, what happens if a marriage entered into in good faith later turns out to be invalid? For example, suppose only later did they discover that they are forbidden family members, or there is some other thing that would have invalidated the marriage at the time but neither of them knew about it.
Does the marriage stand because everyone's intentions were good? Does it stand but require some sort of penance? Is it annulled?
I am asking about canon law, though I am also curious about how they would be counseled, if there is existing guidance on that.
(This is not a practical matter for me, in oh so many ways. I'm just curious.)