/execute at @e[type=chicken] if entity @e[type=item,nbt={Item:{id:"minecraft:iron_sword"}},distance=..2] run summon item ~ ~ ~ {Item:{id:"minecraft:feather",Count:2b}}
for some reason it works but it doesn't work in a command block and if it does it only happens once, like if you spawn another chicken and throw an iron sword it doesn't do the command (this command is linked to other commands)
How is this resolved? I didn't get an answer...