mojira.dev
MC-267193

A function with /return fail run in chat doesn't indicate failure

If a function containing /return fail is run in chat, it returns a success of 1.

How to reproduce:

The attached data pack contains a function named bugtest:fail that runs /return fail.
Run the function with an "execute store result" and an "execute store success".

Observed behavior:

In chat, the message "Function bugtest:fail returned 0" appears and the result is 0 but the success 1.

Expected behavior:

A message "Function bugtest:fail failed" or similar should appear and result and success should both be 0 indicating failure.

Linked issues

Attachments

Comments 5

Confirmed.

Clearer steps to reproduce:

  1. Install the attached data pack.

  2. Run /scoreboard objectives add Success dummy

  3. Run /execute store success score @s Success run function bugtest:fail
    ->❌ Chat returns "Function bugtest:fail returned 0"

  4. Run /scoreboard players get @s Success
    -> ❌ Chat returns "PLAYERNAME has 1 [Success]"

Expected result:

For success 0 is stored.
For command feedback "Function bugtest:fail failed" is returned.

Can confirm in 1.20.4

The issue is not completely gone, the success value now seems to be assigned correctly, however, it is still not possible to distinguish between a function that failed and a function that returned 0, the message is still "Function ... returned 0", which is misleading.

Please create a new issue for this misleading message. I'll mark this issue as Fixed again.

Rob23

(Unassigned)

Community Consensus

Platform

Normal

Commands, Data Packs

1.20.3, 1.20.4

23w51a

Retrieved