The bug
Unlike the other NBT operations that may stop traversing the NBT path early when the current parent NBTs are empty, /data remove
always traverses the NBT path to the end.
Code analysis
net/minecraft/commands/arguments/NbtPathArgument.java
public static class NbtPath {
...
public int remove(Tag target) {
var parents = Collections.singletonList(target);
for(var i = 0; i < nodes.length - 1; ++i) {
parents = nodes[i].get(parents);
// If `parents` is empty, we could return 0 here.
}
return apply(parents, nodes[nodes.length - 1]::removeTag);
}
...
}
Comments 3
Do you mean "doesn't"?
I think it actually has an affect, as in creating the parent tags if they didn't exist, like MC-208974. Not 100% sure though.
This does appear to describe a problem with the game.