The problem I had with mine was the wire was catching and bending up a little with a hard spot where there is a loop guide and actually adjusted too tight causing the wire to bend a little each time.
You probably have already checked this, but suspect the momentary stop switch on the panel. It may have corrosion or dirt in it...
Next disconnect the solenoid and run a jumper and activate it a number of times. Check the throw is the same every time and complete to throw the shutoff valve to it's stops without the wire bending.
Yanmar uses the most simple means with single throw solenoid on that engine to pull the fuel shutoff at the Injection Pump as opposed to other more complicated methods like timers and relays or always off until you turn the key to the on position and turns on the valve, spring throw, double throw... I never understood why they try and make something so simple so complicated sometimes.