I imagine this failed because snap confinement doesn’t allow snaps to modify or create users. You could try looking in the logs with journalctl -ef
and see if there’s anything in there about your snap being denied permission to edit /etc/group or /etc/passwd.
In general, if your snap needs to modify users and groups you may need to wait for the implementation discussed at Multiple users and groups in snaps