May not be of help, but I came across a towing wire harness problem and solution. I've been towing a couple of trailers/caravans, ranging from 3500-5000 lbs, and have been really happy with the diesel's performance. I have the OEM setup: hitch, Tekonsha P2 brake controller, and harness.
Started getting a new set of errors with the newest trailer. It gives repeated taillight/marker light lamp (bulb) outage messages, plus the clearance marker lights flash periodically when the 7 pin umbilical is simply plugged into the X5. But, the brakes, brake lights, and marker lights operate normally with the ignition on.
News to me, this is an issue with all the German SUVs (Audi, VW, MB, BMW) with the same towing electricals - it's the newer LED lamps in the trailer taillights/clearance markers. The previous trailer had a mix of incandescent and LED bulbs, so it didn't reach the low voltage threshold that generates the errors. the clearance lights flash at the same rate as the anti-theft LED lamp on the dashboard.
A pigtail or plug styled bypass adapter solves the flashing, and errors.
Bypass Adapter So, in case this applies to anyone chasing towing bugs...