Do you have a current limit resistor on the optocoupler?
Most are just an LED inside and can likely sink 50mA.
Absolute max of 50mA, while Arduino likely to burn out after 40mA.
Operation characterized for 20mA. Up to user to correctly limit current based on source voltage being used.
For example,with Vf of 1.2V:
(5V-1.2V)/.02A = 190 ohm resistor needed.