Probably a circuit wiring problem or transformer, we had a press brake here that had all the limit switches daisy chained in series, example switch one was wired through switch two and so forth. If any one of the limit switches tripped it opened the shared circuit. We had a bad Cherry Micro switch that played games with us for a while.
Sometimes it worked fine other times odd voltages, odd resistance through that one switch. found the switch that had the problem and changed it out.