Okay that cannot happen, no seriously, that is Mathematically impossible to happen. Do you have some Mod that messes with the Player Inventory, making it bigger or smaller?
Edit: No that cannot be either, because I make sure the Main Inventory is exactly 36 Slots large before doing anything. Something must expand your Hotbar or something and that messes up the whole thing.
that would be the dual hotbars mod. thanks for the help!