While in a datapack .mcfunction file, the command "return run function <function>" returns 0 without executing the function. When running the same command in chat, the function is called as expected. Example:
// --- glitch.mcfunction ---
say glitch/entry
return run function example:glitch2
say glitch/exit
// --- glitch2.mcfunction ---
say glitch2/entry
return 1
When running "/function example:glitch" in chat, this is printed:
Function 'example:glitch' returned 0
[mega12345mega] glitch/entry
I would have expected this to be printed instead:
Function 'example:glitch' returned 1
[mega12345mega] glitch/entry
[mega12345mega] glitch2/entry
When running "/return run function example:glitch2" in chat, this is printed (as expected):
Function 'example:glitch2' returned 1
[mega12345mega] glitch2/entry
If glitch.mcfunction replaces "return run function example:glitch2" with "return run say glitch2/entry", then "glitch2/entry" is printed out in chat as expected. This gives the exact messages that I mentioned above under the section "I would have expected this to be printed instead".
Thank you for your report!
We're actually already tracking this issue in MC-264595, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote or any additional information to the main ticket it would be appreciated.
Please be sure to use the search feature before creating a ticket to see if the issue has already been reported.
Quick Links:
📓 Bug Tracker Guidelines – 🛠 Community Support – 📧 Mojang Support – ✍️ Feedback and Suggestions – 💬 Mojira Discord