What causes eDSPermissionError when running dscl? I'm running Mac OS X 10.14.1 revision 18B75

I created a user using dscl and set its home directory to a wrong path with this command:

sudo dscl . -create /Users/theusername NFSHomeDirectory /the/wrong/path


Now I want to fix this.
I tried these commands:

sudo dscl . -changei /Users/theusername NFSHomeDirectory 1 /the/right/path


and

sudo dscl . -change /Users/theusername NFSHomeDirectory /the/wrong/path /the/right/path


but in both cases I get this:

&lt;main&gt; attribute status: eDSPermissionError
&lt;dscl_cmd&gt; DS Error: -14120 (eDSPermissionError)


Why am I getting a permission error even if I'm running as root?
How can I fix the wrong path?
Its a good question. I honestly have no idea. Does Apple still support using NFS home directories?

The only thing I can think of is to mention that using sudo is not the same as executing a command with uid=0, gid=0. Necessarily. Anymore.

And this is particularly applicable within the context of Directory Services, I think (?),  because that's where you Enable Root User these days. So I might try enabling root in Directory Utility, and trying with a proper su root?