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 library | Exception or error type | Message |
|---|---|---|
| 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 | SimpleErrorTest 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.ErrorTest with redis.IsPermissionError(err) |
NOPERM User <username> has no permissions to run the '<command>' command |
| ioredis | ReplyErrorTest 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\ServerExceptionTest 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
- Find out what was refused. As an administrator, run
ACL LOG. Each entry shows the user, thereason, such ascommandorkey, and theobject, which is the command or key name. - Check which user your app is connected as with
ACL WHOAMI. - Connect as a user that has the permission, or change the user's rules with
ACL SETUSER. For example,ACL SETUSER app +setlets the user runSET, andACL SETUSER app ~otherlets it use the keyother.
See ACL rules and Key permissions.