Please check the shutdown solenoid. It’s a small device on the diesel engine. It is responsible for shutting down the engine by pulling the (internal) fuel rack to the 0 position, or by simply shutting off the fuel supply.
Either way, it could be a mechanical fault or an electrical fault. So first check if the solenoid is getting any power at all.