I haven't been able to replicate this. How often does it happen and under which circumstances? How many stacks of medpacks/fish/grenades do you have and what else is in the inventory?
Only ideas I have currently is that either swap_stack
fails for some reason and mod tries to heal player with a grenade :)
Or item stack (e.g. grenades) runs out and there's issue with stack index, but I'm not sure if that can even happen during script execution.
local cursor = player.cursor_stack
cursor.swap_stack(fish)
player.use_from_cursor(player.position)
fish.swap_stack(cursor)
https://katiska.cc/temp/factorio/mods/autofish-grenade.mp4