When placing a command block with text in it using setblock, certain text or commands cannot be used. If the command has quotations within its data tag, the command will not work. For example:
/setblock ~ ~1 ~-2 command_block 1 replace {Command:"testfor @p {Inventory:[{Slot:34b,id:"minecraft:iron_ingot"}]}"}
The issue is the system cannot tell the difference from starting and ending quotes. When I use the quotation mark to identify the item id, it thinks I'm ending the command to input. When I removed the quotation marks, which are critical to the command block, I can place the unfuctional command block. The commandblock by the way states:
[12:12:30] Data tag parsing failed: Unexpected token 'm' at: minecraft:iron_ingot"}]}"
Thanks
Not a bug.
Either escape the inner quotes:
or use single quotes: