Minecraft – Parsing failed error when spawning a chest preloaded with items

minecraft-commandsminecraft-java-edition

When I use this command to spawn a chest with items already in it:

/setblock 219 230 84 chest 0 replace {Items:[{id:261,Slot:0,Count:1, tag:{ench[{id:49,lvl:100,{id:51,lvl:1}}]}},{id:262,Slot:1,Count:1},{id:310,Slot:2,Count:1},{id:311,Slot:3,Count:1},{id:312,Slot:4,Count:1},{id:313,Slot:5,Count:1}],display:{Name:"Your stuff",Lore:["have fun","and fun"]}}

I get this error:

[19:37:36] Data tag parsing failed: Unable to locate name/value separator for string: ench[{id:49,lvl:100,{id:51,lvl:1}}]

Best Answer

Data tags have the form name : value. The name/value separator is :. You need to put : between the name (ench) and the value ([{id:49,lvl:100,{id:51,lvl:1}}]) of the tag.

There is also a typo in the value itself. Each enchantment has to be given as a compound tag, enclosed in curly brackets. You need to close the first enchantment by putting } after lvl:100, then remove the duplicate one at the end:

ench:[{id:49,lvl:100},{id:51,lvl:1}]