Thanks everyone. I took the bike out for a drive yesterday and so far so good.
As for the cause of the D4 error, I'm really not sure. Like I said before, I cleaned the five metal tabs/bus bars on the end of the controller where the motor cables connect and also unplugged/plugged the three black connectors on the controller. Could be something related to either of those or a strange coincidence.
Please remember to disconnect the blue high voltage connector under the "tank" fairing before performing any work on the bike!
I'd also like to mention that I'll need to replace the 10 mil PVC pipe tape (I think it's 2 inch width) that was wrapped around the outside edge of the controller as well as adding dielectric grease (lots) to the area around the three black connectors on the controller. You can see it in one of the photos. It looks like silicon but isn't of course.
There is a thermal pad between the controller and aluminum heat sink. The Enertia service manual (available in the wiki) mentions it along with the removal procedure.
If you're going to remove the controller, follow these crude and very amateur steps:
1. Remove the round black side covers on the motor, then carefully remove the upper and lower bodywork. Be sure to support the lower
fairing (the part with the black grill on the front) with your hand as you remove the bolts so that it doesn't fall to the ground. I believe the
procedure is in both the owner's manual and service manual.
2. Disconnect the blue high voltage connector under the "tank" fairing. Very important! Injury or damage to components could occur if you
don't.
3. Label each of the five motor cables that connect to the rear of the controller and remove them. I believe that the allen head bolts are 6mm
and the nuts on the front of the bus bars are 13mm.
4. Find a cardboard box or something similar to support the controller after you remove the four mounting bolts. Ideally the top of the box
should be close to touching the bottom of the controller. You don't want the controller hanging freely and putting unnecessary stress on
the wiring/connectors.
5. There's three additional cables that connect to what I'm going to call the top of the controller. Two of them come from the right side of the
frame of the bike and are secured with a single cable tie (zip tie, ty wrap.) The cable tie needs to be removed prior to lowering the
controller because you'll need slack in the cables prior to lowering the controller. These two cables are wrapped in protective black
cloth/tubing.
6. Remove the four mounting bolts on the corners of the controller while applying pressure to the controller to prevent it from free falling. A
6mm allen seemed too small. A 7mm was too large. Use a 1/4 inch if you have one. It fit perfectly.
Keep in mind that the heat sink (silver aluminum part with cooling fins) is not attached to the controller, so try to hold everything together
as one unit (like a sandwich) as you carefully lower it down to your cardboard box/support. You don't want to put stress on the black
plastic connectors. They look fragile.
7. Once you have the controller on the box/support you should see a large amount of dielectric grease packed on and around the connectors.
It may be possible to disconnect the connectors without removing the grease, but I couldn't see the release tabs on the connectors with
the grease in place. I used to small flat blade screwdriver and carefully scooped away the grease a little at a time and wiped it onto a rag.
Once the majority was removed I used cotton swabs on the rest of it.
8. Each of the black plastic connectors has what I'm going to call a release tab that has to be pressed towards the connector at the top to
remove it. Be very careful while removing these. If you break a tab there won't be anything to hold the connector in place. Take your time
and study everything first. I had a hard time with removing these.
It also looks like there was remnants of thermal paste (like a computer processor heat sink) as well. I'm going to try to reach out to Sevcon and get confirmation on this. My thermal pad has a tear and looks pretty rough so I'm going to try to find a replacement. I don't know how much heat the controller generates but it can't hurt.
That's about it. My recommendation would be to first try cleaning the ends of the five bus bars and motor cables with Scotch-Brite or something similar first and see if that clears the D4 error. If not, continue with the controller removal process. I thought I read something in an old post about there being too much dielectric grease in the connector which caused issues, but I could be mistaken. Maybe reseating the black connectors helped. Who knows.
Very happy to have the bike working again. For how long I don't know.
Still love it as much today as the first day I rode it.