Check the grounds, by the starter.
Take them all off, clean each one and the block.
Chase the threads with a tap, and clean washers thoroughly.
Reassemble, and spray with fluid film or equivalent.
Then if it is a Volvo, clean the grounds on the firewall above the pass through.
Lastly, I think it is a Volvo, unplug the ECM connectors and check for green crusties, or moisture intrusion. Clean and lube the connectors seals and reassemble.
Pull the code on the dash, and see if you can Google the code.