mojira.dev
MC-121735

Using /tag add or remove if some entities already have the tag shows that it was successful for all

The bug

Since 17w45a you cannot add a tag to an entity twice. Instead you get the error "Target either already has the tag or has too many tags".

However, when trying to add a tag for a group of entities of which some already have it shows it was added successfully for all of them.

Same for /tag <targets> remove respectively.

How to reproduce

  1. Summon an armor stand with a tag

    /summon armor_stand ~ ~ ~ {Tags:["test"]}
  2. Try to add the tag to the armor stand again

    /tag @e[type=armor_stand] add test

    → It fails as expected ("Target either already has the tag or has too many tags")

  3. Summon a second armor stand without the tag

    /summon armor_stand
  4. Try to add the tag to the armor stands

    /tag @e[type=armor_stand] add test

    → It says it added the tags to both entities ("Added tag 'test' to 2 entities")

Linked issues

Comments 5

This is intentional for all commands with multiple inputs.

I chose to treat things as successful if something happened. If absolutely nothing happened, that's clearly an error. It would become very spammy (and difficult to translate) if we needed error messages like "Well it worked for these, but not these because reasons".

If you need to test individual successes, use `execute as @e[type=armor_stand] run add @s test`

Sorry if the report was not clear enough. I am fine with it not listing it that detailed, but why I meant was that it says it changed the tags for e.g. 2 entities while it actually should have changed it for one only since the other one had the tag already.

The bug here is the exact error message that was not included in the report until now: "Added tag 'test' to 2 entities" even though it only added it to one.

Yep, the command result does not match the success message. The result reflects how many entities were given the tag, where the success message shows how many entities were found, whether they got the tag or not (i.e. they won't get it if they already have it).

After further testing, this issue appears to be more general. I covered the situation as fully as I could in MC-122717.

marcono1234

Nathan Adams

Confirmed

/tag, command-feedback

Minecraft 17w45a, Minecraft 17w45b

Retrieved