Trying to run a command that resolves a score text component results in "An unexpected error occurred trying to execute that command"
For example
tellraw @s {"score":{"name":"test","objective":"anything"}}
It breaks even the objective exists, and the score is assigned.
Using a selector in the name
value instead of a fake player works ok
Linked issues
is duplicated by 1
Comments 2
After some more testing, I think I found a more accurate description of the issue.
The error occurs if the name
(A) looks like a selector (that is, a player name or @
-selector), and (B) fails to find any results. So
normal fake players like
test
errors because the playertest
isn't logged insomething like
@p[tag=faketag]
errors because nobody has that tagprefixed fake players like
#test
work because they aren't parseable as selectors
I'll update the description again accordingly
From code analysis, the issue is evident. In findTargetName
, previously if the selector found no results, the raw string name, which was still stored, was used to look up the score. However, with the refactor to use either
, the raw string name is not present in this case, and so the fallthrough explicitly throws when trying to get it. It seems fitting for empty lists to either resolve to the empty string or throw the ERROR_NOT_SINGLE_ENTITY
error instead, rather than the odd old behavior of attempting to look them up as fake players.
Some behaviour to note:
This seems to entirely crash Brigadier, preventing all further queued commands from running.
This doesn't seem to occur if the scoreholder name is prefixed with a # character.
This doesn't seem to occur on dedicated servers, maybe? (tested on a dedicated server ran with Java version 21.0.2).