What type of generator do you have? It is possible that the fuel is not getting to it & during the first attempt it is priming itself. Then on the second attempt it has fuel, ignition, air & compression so it starts. All 4 must be present for a 4 stroke engine to run.
To start my generator (Onan 5000) I must first hold switch in off position for about 15-20 seconds to prime the fuel, then go to start & it will start right up. If I forget to prime it it takes about 30 seconds of cranking before it will start.
Dan Sees, Full Timing in the MH & Part timing in a S&B In Hampstead, NC
2013 Winnebago Journey 42e, 2014 Featherlite Car Hauler 3110 17.5', 2008 Mazda MX5,
2008 Toyota FJ Cruiser