Before a Court can enter a child custody Order, the Court must have "subject matter jurisdiction," which is governed by Chapter 50A of the North Carolina General Statutes, also known as the "Uniform Child Custody Jurisdiction and Enforcement Act (UCCJEA)." There are four ways that a trial court can gain subject matter jurisdication, and one of those ways is for North Carolina to be the "home state" of the minor child on the date of the commencement of the action, or for North Carolina to have been the "home state" of the minor child within six months of the commencement of the action if at least one parent continues to live in North Carolina after the child is removed from North Carolina.
There is a fairly recent case from the North Carolina Court of Appeals in 2023 (Rook v. Rook) in which a mother moved from North Carolina to Utah with a child, and a custody action was filed in North Carolina MORE THAN SIX MONTHS after the child left North Carolina. The mother and father entered into a "Consent Order on Subject Matter Jurisdiction" and "agreed" that the District Court in North Carolina had subject matter jurisdiction. A Custody trial was subsequently held and a Custody Order was entered. That Custody Order was appealed and the North Carolina Court of Appeals vacated the Order and remanded the case to the District Court for a determination of subject matter jurisdiction.
The important takeaways are that 1) subject matter jurisdiction can be attacked at any time, even after a Custody Order is entered and 2) a Custody Order entered by a Court without specific findings regarding subject matter jurisdiction is void.