The thing that stands out to me is the fact that the machine suddenly quit running, emphasis on suddenly. In my experience that usually points to an electrical problem. Gas doesn’t suddenly go bad (unless water or something contaminated it), an engine doesn’t suddenly lose compression, and air filters don’t suddenly clog (unless you sucked up a plastic bag or something). However electrical components do suddenly fail. Spark plugs foul, sensors fail, wires break or come unplugged. The kicker is that I would expect a sensor failure to trigger an engine code.
Still have to go through the process of elimination and actually verify what is working to find what is not.
I once had a snowmobile that ran great at idle up to about 3/4 throttle then it would cut out almost like it had a limiter ended up being an ignition wire running under the engine that had rubbed the insulation off and would just lightly short out as the thing vibrated at near top speed.
I had a Chinese dual sport bike that ran great for a hour or so then started just dying randomly but would start after a few minutes of sitting ended up being the vent in the gas cap went bad and was not letting air in the fuel tank fast enough to keep up with the engines fuel consumption.
My wife was riding my blaster, we had just started riding that day and all was well until she said it wasn't running right, it ran but not right we load up go home and I tear into it, it has good spark, ok compression and is getting fuel but somewhat sloppy fuel the carb was wet with fuel, dug a little deeper and found the broken reed valve.
We have a gocart that ran great after I put new gears in it but would run for different random amounts of time sometimes just a few minutes sometimes 20 minutes or so ended up being the gas cap vent had been broken inside and had a tiny check valve ball that actually got down into the fuel tube right as it left the fuel tank and would randomly stop or slow fuel flow.
I've learned not to eliminate anything as the problem until proven that it works as it should.
spark plugs can go bad quickly, compression can go quickly as well with 1 stuck/broke valve, electrical stuff can be a major pain and fuel issues can be any number of things.
A good solid spark still needs to be timed right, the air/fuel mixture needs to be right and the engine has to breath with the right compression to run right