It's a GREAT question, and the answer is, January 6th.
At that point Congress will convene to determine whether to accept EC ballots, including whether the votes are valid. THAT is the time to adjudicate this question, not in state courts.
Unfortunately, I fully expect that the people we elected to Congress will fail to do their jobs and will just rubber stamp the reported results.