Synopsis correct?
1. Red and Blue controllers were same. Six pin flat connector and three bullets to motor,,
2. Old Red controller broke. Got (free?) replacement, call it Red2. one. Got E30.
Found Broken black wire in harness. Wire nut fix didn't work,
3. Bought new controller with 9 pin connector, call it New1. Error 30 on both bikes,
4. Set P20=1, No E30. Bike runs. Bad PAS. No speedometer with New1,
5. Tried Blue S866 on New1 , same result,
If the motors are both good, there is no reason why the Red motor shouldn't run off the Blue controller. Put the bikes close together and run the Red motor into the Blue bike, See if it spins and registers speed, with the rear wheel off the ground.
I don't see why the wire nut didn't fix the old adapter cable. It's the ground wire for the motor's three Hall sensors and speed sensor, but there's a possibility one of the motor sensors got damaged. That's why I suggest running the Red motor off the Blue. If it spins, the motor should be good.
I used to have an S866, and it didn't have as many P settings or error codes. They must have done a lot of updates, Maybe the old S866 isn't compatible with new controllers. You might put up a link to the new S866 settings so readers can tell what E30 means, and what the new settings are,
Depending on what happens when you run the red motor off the blue bike (hopefully, it doesn't kill the blue), you may want to try Red2 in the blue bike, or you may want to just buy a new S866.