Had almost exactly this with my Honda EU22i last summer — convinced myself it was the carburettor jets blocked with stale fuel, stripped the whole thing down, cleaned everything spotless, and the fault came back within a week.
Turned out to be the oil level sensor playing up. Engine would run fine for 20-30 minutes, warm up, then the sensor would give a false low-oil reading and cut it dead. Classic symptom is it restarts no problem once it's cooled slightly — does yours do that?
A few things worth ruling out in order:
- Fuel age — anything over 30 days in the tank can gum up the carb needle valve on smaller generators. I now add Briggs & Stratton fuel stabiliser if it's sitting more than a fortnight
- Air filter — mine gets mucky surprisingly fast when running near the garden office
- Load spike — what are you running off it? My inverter charger (Victron MultiPlus) occasionally pulls a nasty startup surge that trips cheaper generators under a certain load
- Earthing — sounds odd but a poor earth connection can cause all sorts of phantom shutdowns
The stale petrol theory is worth pursuing first because it's cheap and easy — drain the tank completely, run the carb dry, fresh fuel in. Ethanol-free from a decent forecourt if you can find it.
What make and model is it, and roughly how old? That'll probably narrow it down considerably. Others on here have seen similar with certain Hyundai and Kipor units that have known sensor quirks.