When attempting to replace vanilla recipes, by putting recipes in data/minecraft/recipes/..., it simply doesn't work, unlike loot tables, or advancements, which replace their counterparts when placed in that section. Instead, the recipe is marked as "A duplicate", and it crashes out your game when attempting to load the world with the pack installed.
However, when you add in the recipe when you're already in the game, it works fully.
An example data pack is attached, which attempts to replace the sugar cane -> sugar recipe with a diamond -> sugar recipe. (dinnerboneNeedsToAddScoreboardRandomization.zip)
If you load the data pack while already in the world, the recipe works, with an odd error. It'll work, but if you click the recipe in the recipe book, without the diamonds, it shows that you need sugar cane to craft it, while you just replaced the recipe with diamonds.
If you add it in outside the world, the game will crash, but not close.
> Only mark recipes that are exact duplicates of the recipe as duplicates.
> Don't trash duplicates, instead, only recognize them if they're in the same "group" as the original recipe, not unlike the iron nuggets -> ingot, and iron blocks -> ingot recipes.
> Simply send an error, and don't load the recipe, instead of freeze-crashing the game.