The bug
When you use `/data modify` and it doesn't find the thing specified in the path, it creates that tag. However, if that path contains a list (that doesn't exist) with an index, it doesn't create the list.
How to reproduce
Set a chest with an item
/setblock ~1 ~ ~ minecraft:chest{Items:[{Slot:0b,Count:1b,id:"minecraft:dirt"}]}/setblock ~1 ~ ~ minecraft:chest{Items:[{Slot:0b,Count:1b,id:"minecraft:dirt"}]}Try to give the item lore by `set`ting `Lore[0]`, this fails because the `Lore` list doesn't exist
/data modify block ~1 ~ ~ Items[0].tag.display.Lore[0] set value "\"hi\""/data modify block ~1 ~ ~ Items[0].tag.display.Lore[0] set value "\"hi\""
Comments 5
But I understand that’s list creating upon non-existence can cause a lot of inconsistencies/problems/unintuivities
Yes, that's what I said: no changes in behavior. This makes it feature request.
`append` and others have pretty clear semantics. On the other hand, writing to non-existing slot does not have one.
WAIsh. It is unclear, what would happen when you try to set `Items[1]` on non-existing list. Filling to default value would probably work, but it may be error-prone. And what about `Items[-2]`?
Note that this behavior existed before, since `execute store` worked same way.