About 1/2 of my Genesis models have had a key problem and some have been back 2 times. I tend to send them back so they can learn about their quality issues, but it can take too much time.
Richard
If you are saying that wiring the decoder directly to the rails makes it produce sound, and that inside the engine and wired seemingly correctly it doesn't, then the problem is between the rails and the decoder, but in all that lies between when mounted inside the loco or its frame. You have a dirty wiper, or a broken wire, or an iffy solder...not sure which, but somewhere between the rail and where the decoder sits in the loco is a break in continuity. Could even be corrosion.
Crandell