Are you using the standard xattr command that's built into macOS? IIRC there's another program out there by the same name with completely different syntax. Try running type xattr; it should say something like "xattr is /usr/bin/xattr" if you're using the standard one.