Cannot add system user after removing it

Hi, I tried removing a system user using snapd rest api when the user was logged in. So, it return false as the user was being used.

So, after the user logged out, i had to wait for the timeout to finish to remove it.

Once i remove it, I was not able to add any user without restarting the system. This happens only when I try removing a user when it was logged in and it fails.

When i tried adding the user, The message returned: “the user keys are invalid”

Is this a bug?