It maybe the case that an alternative character you were using occupied the slot on their inventory and the current client session thinks the primary, secondary or melee slot is already occupied by the other character depending which slot is used. Either switch to the character that has the weapon currently equipping the slot, unequip them and switch to the desired character and equip the gun, it should fix it. Another solution is to simply reconnect. I have the same issue with switching from CP to OTA as my primary slot from my CP was used on the same session and when switching to OTA, I cannot equip my primary rifle.