Yeah, I've got this, too. I think it usually only happens when you don't have an open inventory slot and the stack of items on the ground is larger than the open space in a partial stack you have in your inventory.I'm getting a similar issue where if all the slots of my inventory are full sometimes i can't pick up certain items like torches that i already have a partial stack of, doesn't matter how big that stack is. But if i open up a slot, then i pick it up and it stacks just fine.
The closest thing to a solution I've found is to open your inventory, pick up the partial stack, let the items on the ground pop into the now-open slot, click that slot to fill it with the items attached to your cursor, and close your inventory to drop the rest back on the ground. Or just ignore it; it's not like I really needed that last cobblestone or two on this trip, anyway.