Diagnosing electrical problems in modern cars is a specialty. Cars today have so many sensors. Any corrosion can create a bad connection. It can be challenging to trace. Especially when the mechanic can’t even see the wire buried deep in the engine compartment.
I watch the younger mechanics on YouTube and am amazed at their patience. Sometimes it takes hours of disassembly to replace a simple part.