I'd be willing to bet it's a loose ground wire. My grounds were a mess for my lighting. All of my grounds were tied together in a giant wire nut, there were about 14 wires in one wire nut. I ended up taking it apart and used a ground bus bar to clean it up.

Sent from my SM-G950U using Tapatalk