For starters, it could be bad battery, poor battery connections, stator coil, or rectifier/regulator.
Check the battery voltage level with the switch off. It should be 13 to 13.5V.
If it's less than 13V, then the battery is low, which could be a bad battery, loose or corroded battery connections, or charging system.
Crank the engine and measure the voltage at 4000 RPM, it should be 14 to 15V.
It should NOT be over 15.5V.
If you're not getting 14V or above, then it is probably charging system.
Switch off the engine and pull the alternator connector, then check each stator coil resistance, and each to ground.
All stator coils should be within spec. You should not get a coil whose resistance is too low or too high, and no continuity to ground.
If the stator coils check out, then it might the rectifier/regulator.
One thing to always keep in mind is, weather is the enemy of electrics.
Many electrical problems can be traced to tarnished/corroded contacts on electrical connectors, especially over time in humid weather.
Buy a tube of delectric tuneup grease (5 oz. tube will last forever) and poke a dab into every electrical connector you can lay a hand on.
It waterproofs the contacts, prevents corrosion, and also allows easier disconnection.
And lastly, check the idle speed of the engine. It should be 1300 RPM +/- 100 RPM.
If the idle is at 1100 RPM, it may not be charging the battery at idle.
On my VFR800, I found that at 1300 RPM, the alternator output is 13.5V, which will maintain the battery voltage at idle (not charge the battery, just maintain).
If the idle was set to 1100 RPM, the output dropped to 12V, which is not enough to maintain proper battery charge. The bike then is running off the battery.
If you get stuck in a traffic jam or situation where there is lengthy idling, the battery voltage may drop to 12V or less that will not maintain operation of the ECU.
In that case, the ECU may cease operating and the engine will stop running, and fail to crank.
I also found on my VFR800, that at even 1500 or 1800 RPM, the alternator output was at 14.7V, which is enough to charge the battery, even with high beam on.