Minecraft – Help with this Minecraft command! Why isnt it working

minecraft-commandsminecraft-java-edition

So I am making a map with lots of commands and so it is easier to copy/paste commands. But when I put in the following command, it says this, "Data tag parsing failed: Invalid tag encountered, expected '{' as first char." I've tried a lot, but I cant get it!

Command:

/testforblock ~ ~2 ~minecraft:standing_banner 0 replace{Base:15,Patterns:[{Pattern:ss,Color:1},{Pattern:tr,Color:4}]}

I am though putting in another command and it is of placing a command block with that command inside it. It is working. This is the other command:

/setblock 1153 30 -1769 command_block 0 replace{Command:"/testforblock ~ ~2 ~minecraft:standing_banner 0 replace{Base:15,Patterns:[{Pattern:ss,Color:1},{Pattern:tr,Color:4}]}",}

Best Answer

Syntax for testforblock is:

/testforblock <x> <y> <z> <TileName> [dataValue] [dataTag]

The problem you are having seems to be caused by the fact you've added the word "replace" between the dataValue and dataTag (likely caused by copying and pasting from a setblock command).

Remove the replace, and it should work fine:

/testforblock ~ ~2 ~ minecraft:standing_banner 0 {Base:15,Patterns:[{Pattern:ss,Color:1},{Pattern:tr,Color:4}]}