If I understood correctly, you are trying to see if there is any archived events after a specific timestamp in the past, correct me if I'm wrong. Let's say 1 hour ago is the time you want to look at, you can implement something like following:
Tag.PreEvent("*-1h").UTCSeconds == Tag.PreEvent("*").UTCSeconds which means the last archived value at one hour ago is actually the most current snapshot value, then do not use tag.nextEvent or tag.nextVal method to avoid the error.
Please let me know if this helps.
Thanks! That really helps a lot, it is a working solution.
I don't even need to call Tag.PrevEvent("*-1h") -> this saves one PrevEvent call: TimeOneHourAgo.UTCSeconds >= Tag.PrevEvent("*").UTCSeconds