Exception when accessing datapack recipes that were ignored by the server
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Expected behavior
I've noticed that datapack recipes that are ignored by minecraft are still detected when accessing it through bukkit.
Here is an example of an ignored recipe. It is because it uses a tag for ingredients, but the tag is empty. So it results in an empty ingredient list:
data/test/recipe/stick.json
{
"type": "minecraft:crafting_shapeless",
"category": "misc",
"ingredients": ["#test:ingredients"],
"result": {
"count": 1,
"id": "minecraft:stick"
}
}
data/test/tags/item/ingredients.json
{
"values": []
}
Server logs show this on load:
Recipe namespace:stick can't be placed due to empty ingredients and will be ignored
However, when I use Bukkit.recipeIterator() to iterate through recipes it comes across this recipe and throws and exception:
java.lang.IllegalArgumentException: empty RecipeChoice isn't allowed here
at org.bukkit.inventory.EmptyRecipeChoice.validate(EmptyRecipeChoice.java:30) ~[paper-api-1.21.9-R0.1-SNAPSHOT.jar:?]
at org.bukkit.inventory.ShapelessRecipe.addIngredient(ShapelessRecipe.java:135) ~[paper-api-1.21.9-R0.1-SNAPSHOT.jar:?]
at net.minecraft.world.item.crafting.ShapelessRecipe.toBukkitRecipe(ShapelessRecipe.java:43) ~[paper-1.21.9.jar:1.21.9-37-6950f05]
at net.minecraft.world.item.crafting.ShapelessRecipe.toBukkitRecipe(ShapelessRecipe.java:19) ~[paper-1.21.9.jar:1.21.9-37-6950f05]
at net.minecraft.world.item.crafting.RecipeHolder.toBukkitRecipe(RecipeHolder.java:15) ~[paper-1.21.9.jar:1.21.9-37-6950f05]
at java.base/java.util.Optional.map(Optional.java:260) ~[?:?]
at org.bukkit.craftbukkit.CraftServer.getRecipe(CraftServer.java:1508) ~[paper-1.21.9.jar:1.21.9-37-6950f05]
at org.bukkit.Bukkit.getRecipe(Bukkit.java:1155) ~[paper-api-1.21.9-R0.1-SNAPSHOT.jar:?]
Exception is also thrown when calling Bukkit.getRecipe(key) to target that recipe.
Bukkit should be ignoring this recipe when.
Observed/Actual behavior
Bukkit tries to access/rebuild datapack recipes that were ignored by the server.
I also wrote up some quick code to check the nms recipe registry and found that the ignored recipe was NOT in the registry.
Steps/models to reproduce
In datapack: Create an empty item tag.
In datapack: Create a recipe that uses that tag as an ingredient.
In plugin: Try accessing the recipe through Bukkit.getRecipe(key) or Bukkit.recipeIterator().
Launch server.
Notice logs show that it ignored the recipe.
Notice plugin throws exception as it tries to rebuild that recipe.
Plugin and Datapack List
1 basic test plugin, just for testing this issue.
1 basic test datapack, just for testing this issue.
Paper version
This server is running Paper version 1.21.10-84-main@bac3da1 (2025-10-20T02:11:40Z) (Implementing API version 1.21.10-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.9-37-6950f05 (MC: 1.21.9)
Other
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with CraftServer.getRecipe and RecipeHolder.toBukkitRecipe in the stack trace, then inspect how ignored recipes reach ShapelessRecipe.toBukkitRecipe and EmptyRecipeChoice.validate. Reproduce the empty-tag datapack case through Bukkit.getRecipe(key) and Bukkit.recipeIterator(); done means ignored recipes are not rebuilt or exposed and neither call throws an exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100