There's 2 other possibilities, depending on mileage or previous treatment of the bike:
1. If the bike was shifted quite a bit without the clutch (i.e., street fighters), the little shift arm ratchet might be bent, or the drum's retainer plate screw might have come loose a couple of turns. Both of these things will cause an incomplete shift into gear, which then tends to pop back out because the dogs are not fully engaged. At high RPM, the crankcases twist a little from the torque and the mainshaft binds just a hair, which forces the countershaft to misalign and the partially-engaged dogs to slip out of position. A fully-engaged gear dog meshes about 4-7mm, while a partial shift is typically around 2-3mm (which will pop back out). This equipment can be easily checked by looking under the tranny cover on the left side, where the shifter is located.
2. If the bike has lots and lots and lots of miles on it (K0 through K3 models), the tips of the grooves in the shifter drum might be worn down, especially in the lower 3 gears, from city traffic shifting. Honda changed this drum in the K4 model to have slightly wider tips at the ends of these track grooves, just to ensure fewer jumpouts with accumulated miles. That worked, but also made the gearbox always feel a little stodgy, forcing the rider to be deliberate about the shifting action. The early and late parts interchange with each other: if you're a 'normal' rider, look around for someone here who has an extra one from a previous parts bike, if you decide you need one. This exchange requires splitting the cases though.