Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-121662

Unhandled exceptions in commands just dump the exception into chat, without the "unknown error" message

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 17w45a, Minecraft 17w45b, Minecraft 17w46a, Minecraft 17w47a, Minecraft 17w47b, Minecraft 17w48a, Minecraft 17w49a, Minecraft 17w49b, Minecraft 17w50a, Minecraft 18w01a
    • Fix Version/s: Minecraft 18w02a
    • Confirmation Status:
      Confirmed

      Description

      If a command has an unhandled exception, the exception's message is simply dumped into chat (e.g. java.util.NoSuchElementException) without any context, and no stacktrace is printed in the server console. In prior versions, it would output An unknown error occurred while attempting to perform this command (commands.generic.exception).

      This is problematic for 2 reasons:

      1. It's not clear to the user what went wrong - just that an exception of some sort was thrown (this is fine if the exception has a user-friendly message, but in these cases it doesn't since they're unexpected)
      2. The lack of a stacktrace means that it's basically impossible to debug. No stacktrace on command-specific syntax exceptions is fine, but for other unexpected exceptions it's not (e.g. a NullPointerException - not knowing the line it occurred on makes it pretty much useless)

      Reproduction is hard - but right now this can be reproduced through MC-121661 (running /help asdfasdfasdf), or through MC-106551 (how I first encountered it – not recommended for general testing though)


      As of 17w45b, a stacktrace is now printed at level ERROR. However, this also isn't ideal, since this happens for brigadier exceptions too (which have the stacktrace disabled, but it implies something went wrong at a deeper level).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dinnerbone [Mojang] Dinnerbone (Nathan Adams)
                Reporter:
                pokechu22 [Mod] Pokechu22
              • Votes:
                7 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: