First, using my moderator superpowers I have moved this out of the Developer Community Feedback group (intended only for feedback about the DC platform) and into the Cache group.

The <NETWORK> error code hints that your Cache instance is involved in some ECP networking. Maybe that is having a problem. Check cconsole.log at both ends of the connection(s) for clues.

In general though, I suspect your issue is too site-specific for DC members to be of much help. I recommend you open a support ticket with InterSystems WRC.

Also, a similar kind of check using a method of %SYSTEM.Security is not case-sensitive with respect to the username:

USER>w $system.Security.CheckUserPermission("laura_test_DEV","%Development")
USE
USER>w $system.Security.CheckUserPermission("laura_test_dev","%Development")
USE
USER>w $system.Security.CheckUserPermission("laura_test_devX","%Development")
 
USER>

The priv check is case-sensitive on the username:

USER>w $system.SQL.CheckPriv("laura_test_dev","9,%Library.File_FileSet","e","USER")
0
USER>w $system.SQL.CheckPriv("laura_test_DEV","9,%Library.File_FileSet","e","USER")
1
USER>

Anyway, I'm glad it's now working for you.

BTW, to paste an image into a DC post I save it to a file, then use the following button in the DC editor to upload the file:

And then I sometimes (as above) use the Image button on the toolbar to add a 2-pixel border to the image, then the Increase Indent to move it across.

Are you sure that you granted your test user the EXECUTE privilege on the procedure in the actual namespace where it will be executed?

I created a new user "laura" who only has the %Developer role. From the USER namespace in Terminal she can't prepare the class query:

USER>w $username
laura
USER>w $roles
%Developer
USER>
 
USER>s st=##class(%SQL.Statement).%New()
 
USER>s ok=st.%PrepareClassQuery("%File","FileSet")
 
USER>d $system.Status.DisplayError(ok)
 
ERROR #5540: SQLCODE: -99 Message: User laura is not privileged for the operation
USER>

Then in Portal I granted her EXECUTE on the procedure, per my previous screenshot, being careful to do this in the USER namespace. Now the test results are as follows:

USER>k
 
USER>s st=##class(%SQL.Statement).%New()
 
USER>s ok=st.%PrepareClassQuery("%File","FileSet")
 
USER>d $system.Status.DisplayError(ok)
 
USER>

And here are a couple of lines where I confirm that the user "laura" has the necessary privilege in the USER namespace but not in the %SYS namespace:

USER>w $system.SQL.CheckPriv("laura","9,%Library.File_FileSet","e","USER")
1
USER>w $system.SQL.CheckPriv("laura","9,%Library.File_FileSet","e","%SYS")
0
USER>

A long shot: if auditing is turned on, and the %System/%Security/Protect  event is enabled, does anything get logged when the user encounters the failure?

Failing that, can you debug through the %PrepareClassQuery method of %SQL.Statement in the context where it's failing for you? Not so easy when the call works for your user when run in Terminal.