mojira.dev
MC-309913

You can create a scoreboard objective with a blank name (not display name)

Short description:

When using the command scoreboard objectives add <objective> ..., the “objective” argument can be blank, which creates an objective with a name of "" (empty string).

How to reproduce:

You can use the following command to create an objective with an empty name. Since the chat automatically collapses consecutive spaces, you have to run this command from a command block (or datapack):

scoreboard objectives add  dummy

(Note the double space where the objective name would normally be.)

Current behavior:

The above command works, and creates an objective with an empty name.

This objective can now be used for some things, but the name being empty means that this objective cannot be used as the last argument of a command.
For example, this will work (in a command block):

scoreboard players add @a  5

…but this will not (even with 0, 1, or 2 spaces after the end of the command):

scoreboard players reset @a 


Expected behavior:

An empty objective name should be considered invalid syntax.

This bug may affect other commands that use unquoted string arguments, since the problem is caused by the implementation of StringReader.readUnquotedString() in Brigadier, which returns an empty string if there are no valid characters instead of throwing an error. Any command arguments that use this method should probably check that the returned string is not empty.

Linked issues

Comments 2

Thank you for your report!
We're tracking this issue in MC-277004, so this ticket is being resolved and linked as a Duplicate.

That ticket has already been resolved as Working as Intended, which means this is not considered a bug and won't be fixed. Please do not leave a comment on the linked ticket.

If you haven't already, please make use of the search feature to see if an issue you are about to report has already been reported.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

The scoreboard case is slightly different than the linked report (although /scoreboard is mentioned there) because the name of the scoreboard is not a namespaced identifier. This means that unlike /data, /attribute, etc., it is impossible to delete the scoreboard objective once it is created, because you cannot use minecraft: to refer to the same identifier.

mr_cheese

(Unassigned)

Unconfirmed

26.2

Retrieved