While in your inventory, with items in your hotbar, quickly hitting the numbers while in creative mode can cause some items to overwrite others, and create a duplicate of one item, while removing the other. This does not work in survival.
Spam-clicking items causes same effect. Can sometimes disappear even in survival, see MC-4108.
Easy way to reproduce:
Open the inventory
Put two different items in slots 1 and 2
Hold the mouse over slot 2
Press and hold "1"
The items will swap a while and eventually the item of slot 1 overwrites the item of slot 2
Related issues
is duplicated by
Comments
You have to have your inventory open
http://www.youtube.com/watch?v=EDJ7fNwK3L0 demonstration of the glitch

Confirmed for 12w49a.
It's not necessary to jam on one of the number keys, it's enough to keep a key pressed for some time.
Sorry, can confirm in 13w42b
Confirmed for 1.7.2

Is this still a concern in the latest Minecraft version 14w02c? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.
Confirmed for 14w18b.

Confirmed for 14w28a.
Confirmed for 14w28b
Confimred for 12w32a, b, c, and d
Confirmed for 1.8.

Confirmed for 1.8.1-pre2. (I switched a minecart with a creeper spawn egg and upon right clicking on the minecart a creeper spawned and the inventory slot immediately changed to the creeper spawn egg.)

Confirmed for 1.8.1 and 1.8.2-pre1.
Confirmed for 15w44b. Here is a slightly different way of reproducing this.
1: Put a stone and a sapling in first and second hotbar slot respectively.
2: While hovering over the second item, hold the 1 for a few seconds.
3: It will seem like nothing has happened. Hower, if you exit to the title screen and reopen the world, the sapling will have turned into stone.
A few points:
It shouldn't take more than 3 tries to reproduce the bug. If it does, put the two items in the opposite order.
It seems like the item with the lowest numerical ID always overwrites the item with the highest ID.
This bug works (seemingly) for any item, if the two items only differ in data value, the one with the highest data value will change to match the one with the lowest data value.
Confirmed for 1.8.9 and 15w51b.
Confirmed for 16w02a.
Confirmed for 1.9-pre1
Confirmed for 1.9.0
May be fixed on 1.9.1-pre3. Happened within 2 seconds in 1.9; could not reproduce within ~60 secs in 1.9.1-pre3.
EDIT: I just reloaded the world in which I did my testing, and the blocks are duplicated!
Confirmed for 1.9.3-pre3.
Only appears client-side upon reloading the world.
Confirmed for 1.9.4.
Confirmed for 16w20a.
I can't get this to happen in 16w21a (I did reload the world). More testing is required.
Confirmed for 16w21b. This happened without reloading the world.
Confirmed for 1.10-pre1. Doesn't seem to happen in the "Survival Inventory" tab.
Confirmed for 1.10-pre2.
Confirmed for 1.10.

I just reproduced it pretty quickly in 1.10, but then I wasn't able to reproduce it for a long time with different setups mentioned here. Does anyone have tips?
Confirmed for 1.10.1.
@unknown: Do not be in the Survival Inventory tab.
Confirmed for 1.10.2.

Again: I reproduced it by letting another program type 1.000 "2"s, but then I tried multiple times again and even changed the number to 10.000, but didn't get it. @unknown, how do you reproduce it usually?
I put four items with different IDs (not sure if necessary) in slots 1, 2, 3, and 4; then I spam the 1, 2, 3, and 4 buttons while moving my mouse left and right over the slots.
@unknown: Here's a video demonstrating the bug. Sometimes it is necessary to reload the world to see the duplication.
Unable to reproduce anymore in 16w42a, possibly fixed.
Tried all the aformentioned methods, as well as the method I used to use myself in the past, but it doesn't seem to occur anymore.
Resolved as fixed, please update if you can still reproduce this bug by providing proper steps.

Managed to reproduce this in 18w43c in creative mode. Please reopen.
 EDIT: I can reproduce this every time by just holding down a number key.

This has been closed for over a year. Can you please make a video in which you reproduce it?
I'll also try to reproduce it in ~10 hours, I had a pretty reliable way to reproduce it on my old PC, I could transfer it to the new one.

Confirmed in 18w43c, too.
Cannot reproduce 😞