To reproduce:
Drop a sword close by
execute
/data merge entity @e[distance=..3,limit=1,type=item] {Item:{Enchantments:[{lvl:1,id:"minecraft:sharpness"}]}}
->chat says "modified data of sword"
nbt stays unchanged
i've already tried f.ex. making an armorstand invisible, that worked though.
also giving yourself a sword with the same nbt (without Item:{} obviously) works as well
You forgot
tag