It is impossible to damage any mob regardless of what tool/item you're holding, when the player has weakness applied. It's like the mob's hitbox has been removed, it's like you're punching the air, but the crosshair indicator still comes up. This is in singleplayer.
This is the same issue as MC-268800. Due to this bug, in this snapshot all weapons only deal 4 HP damage. Weakness subtracts 4 HP from your attack damage. Thus you attack with 0 HP damage, which has no effect.