If switching wires doesn't work check your ground must be very clean and connected to bare metal on frame.
It's almost always the ground. Easier to run ground wires all the way to the lights. No more problems that way.
Finally getting time to reconnect all the wires and we what happens. Just have to make a run to the hardware store. Each light already has a ground. A white wire comes off each light.
The white wire from the harness and the lights normally connects to the frame. I just run the white wire from the harness directly to the lights, eliminating the frame as a ground. It saves a lot of problems due to corrosion.
Also found that since the trailer frame is ground, where the pin is located to remove it and tilt the utility trailer back for dumping, rocking the trailer up and down breaks the ground (where frame sits on itself) and causes the lights to flicker. A permanent bolt should take care of that problem!
I run the white wire from the tongue all the way to the white wire coming out of the the tail lights. If there is no white wire coming from the lights the mounting bolt serves as the ground. In that situation i put a ring terminal on the white wire and place it behind the mounting bolt of the taillight. Still have some corrosion issues but not nearly as many when using the frame as the ground.
Run a heavy ground wire from one section of the trailer to the other. Put a small loop in it so it flexes and you can retain the tilt feature of the trailer. Besides, it will only rust eventually with the permanent bolt and you will again have grounds issues. Or run a white wire from the plug to all the lights as others have said.