Cannot update Mac OS. "There was an error in Software Update preferences." Mojave
I had a similar error. I my case, I think it was caused by a borked system or Xcode update (not sure which or if something else entirely). 

I was able to get everything back to normal after updating from the Terminal command line using softwareupdate. You can see all the options with

softwareupdate --help


What worked for me was just to install everything that needed to be installed, which I assume included the broken installation, using

sudo softwareupdate --install --all


After a shutdown (not reboot) per the instructions, my computer performed a solid update and all was well.