a judicial ruling that cannot be overturned, or does it require another judge to rule on its validity?
There are two opinions on this within the schools of al-Shāfi‘ī, Ahmad, and others. The sounder of the two is the first.
However, the judge who performed this marriage is a Shāfi‘ī. If he followed the opinion of those who consider this marriage valid, observed all its other conditions, and was entitled to do so, then it was permissible. If, however, he proceeded with something he believed to be forbidden, his action was impermissible. If he thought she had reached puberty and married her off, but she had not reached puberty, then he did not in fact conclude her marriage, and the marriage is invalid. Allah knows best.
He was also asked—may Allah have mercy on him:
“A man found a little girl and raised her. When she reached puberty, the judge married her to him, and he was blessed with children by her. Later, it was discovered that she had a brother. Is this marriage valid?”
He replied:
If she had a brother who was absent and out of contact, and, because she had become separated from her family in childhood, it was not known until after the marriage that she had a brother, then the marriage in question is not invalidated. Allah knows best.