As you said, you probably have a loose connection somewhere. Your going to have to follow the wire back. With someone watching the controller, start shaking the wiring along its length till the problem appears, hopefully.
You didn't say what controller you have nor what read out you were getting. A wild guess since you have a written message is a Tekonsha P3.
Here's a demo:
https://www.youtube.com/watch?v=TaPhtlBNVJU
Says is should display "No trailer connected" if it's not plugged in.
As BoxerLover said, I've also found brake problems at the 7 pin connector a couple of times.
Also had them once when we acquired a new puppy. He also chewed the overflow line on the fresh water tank.