On both of my phase 2s I've had an intermittent connection on the bonnet microswitch cause this problem, I can't remember exactly what I did now but in both cases it involved some precision bending of the thin metal contact strip so when the bonnet is closed it actually makes full contact with the push in part of the switch.
EDIT: found my old thread with pictures that Gatos very kindly added.
https://www.volvoforums.org.uk/showthread.php?t=280403