S04009
Error Code
S04009
Error Message
Login is required for script execution with client authentication enabled.
RefId: S04009
Probable Causes
When the server configuration parameter enableClientAuth is set to true, guest users must authenticate before executing scripts. If the current session is still running as the guest user and attempts to execute a regular script or an AI script, or to call a function that is only available to authenticated users, the server rejects the operation and returns this error.
Solutions
-
Authenticate with a valid username and password, then re-execute the script within the same connection or session.
-
If using connection pools, streaming subscriptions, or automatic reconnection, ensure that each new or re-established connection is configured with the correct login credentials. You can use
isClientAuth()to check if client authentication is enabled on the server. -
If client authentication is not required for your business needs, you can set the enableClientAuth configuration parameter to false after assessing the security implications, and restart the relevant nodes for the changes to take effect.
