NOPERM error

The user is authenticated but isn't allowed to run the command or use the key.

Redis returns this error when you're authenticated, but your user's access control list (ACL) rules don't allow what you asked for. The message says what was refused, a command or a key:

NOPERM User app has no permissions to run the 'set' command
NOPERM No permissions to access a key

In client libraries

Client libraryException or error typeMessage
redis-py NoPermissionError User <username> has no permissions to run the '<command>' command
Jedis JedisAccessControlException NOPERM User <username> has no permissions to run the '<command>' command
node-redis SimpleError
Test with err.message.startsWith('NOPERM')
NOPERM User <username> has no permissions to run the '<command>' command
Lettuce
The async API wraps the exception in an ExecutionException (get()) or a CompletionException (join()).
RedisCommandExecutionException NOPERM User <username> has no permissions to run the '<command>' command
go-redis redis.Error
Test with redis.IsPermissionError(err)
NOPERM User <username> has no permissions to run the '<command>' command
ioredis ReplyError
Test with err.message.startsWith('NOPERM')
NOPERM User <username> has no permissions to run the '<command>' command
StackExchange.Redis
NRedisStack uses StackExchange.Redis, so it raises the same exceptions. The sync and async APIs raise the same exceptions.
RedisConnectionException It was not possible to connect to the redis server(s). Error connecting right now. To allow this multiplexer to continue retrying until it's able to connect, use abortConnect=false in your connection string or AbortOnConnectFail=false; in your code.
StackExchange.Redis sends commands when it connects, and the ACL rules of the user in this example refused them.
Predis Predis\Response\ServerException
Test with $e->getErrorType() === 'NOPERM'
NOPERM User <username> has no permissions to run the '<command>' command
redis-rb Redis::PermissionError NOPERM User <username> has no permissions to run the '<command>' command (redis://<host>:<port>)
redis-rs
The sync and async APIs raise the same errors.
ErrorKind::Server(ServerErrorKind::NoPerm) NoPerm: User <username> has no permissions to run the '<command>' command

Example

The user app can only run GET, and only on keys that start with allowed::

> ACL SETUSER app on ><password> +get ~allowed:*
OK
> AUTH app <password>
OK
> SET allowed:1 "x"
(error) NOPERM User app has no permissions to run the 'set' command
> GET other
(error) NOPERM No permissions to access a key

How to fix it

  1. Find out what was refused. As an administrator, run ACL LOG. Each entry shows the user, the reason, such as command or key, and the object, which is the command or key name.
  2. Check which user your app is connected as with ACL WHOAMI.
  3. Connect as a user that has the permission, or change the user's rules with ACL SETUSER. For example, ACL SETUSER app +set lets the user run SET, and ACL SETUSER app ~other lets it use the key other.

See ACL rules and Key permissions.

RATE THIS PAGE
Back to top ↑