How to fix ERR operation not permitted in Redis

RedisINTERMEDIATEHIGHUpdated Dec 25, 2025· 182 views

This error occurs when a Redis command is blocked by authentication, ACL permissions, or replica mode restrictions. It typically happens when credentials are missing, user permissions are insufficient, or you're trying to write to a read-only replica.

Quick fix

Fixes ERR operation not permitted

redis-cli
> COMMAND
  1. Verify Redis requires authentication with "AUTH"
  2. Check current user and ACL permissions (Redis 6.0+)
  3. Grant necessary command permissions
  4. Ensure client re-authenticates on reconnection
redis — error
redis-cli
> COMMAND
ERR operation not permitted

What this error means

Redis returns this error when the requested operation is not allowed under the current security configuration. The most common cause is missing or invalid authentication, but it can also indicate insufficient user permissions in Redis 6.0+ ACL (Access Control List) settings, or an attempt to write to a read-only replica instance.

Typical symptoms

  • Commands fail with 'ERR operation not permitted' error message
  • Application cannot authenticate with Redis server
  • Write operations fail while read operations succeed (read-only replica)
  • User has insufficient ACL permissions for specific commands or keys
  • Connection works initially but fails after timeout/reconnection

Common causes

  1. Missing or invalid password when connecting to a requirepass-protected Redis server
  2. Client library not re-authenticating after connection timeout or reconnection
  3. User lacks necessary permissions in Redis ACL configuration
  4. Attempting write operations on a read-only replica instance
  5. Key access restricted by ACL key patterns that don't match the operation
  6. Volume or file permission issues when running Redis in a container

How to fix "ERR operation not permitted"

1Verify Redis requires authentication with "AUTH"

Connect to Redis and check if authentication is required:

bash
redis-cli
> COMMAND

If you get "ERR operation not permitted" or see a "requirepass" in config, you need to authenticate first:

bash
redis-cli
> AUTH your_password
OK
> PING
PONG

If using a client library, ensure you pass the password in the connection options.

2Check current user and ACL permissions (Redis 6.0+)

If you're using Redis 6.0 or newer with ACL enabled, check your current user:

bash
redis-cli
> AUTH username password
OK
> ACL WHOAMI
"username"
> ACL LIST

Review the output to see what commands your user is allowed to execute. Look for lines starting with your username showing permissions like +@read, +@write, or +@all.

3Grant necessary command permissions

If your user is missing permissions, log in as an admin (or the default user) and grant them:

bash
# For specific commands
ACL SETUSER myuser +get +set +del

# For command categories
ACL SETUSER myuser +@read +@write

# For all commands
ACL SETUSER myuser +@all

# For key patterns
ACL SETUSER myuser ~myprefix:*

# Save changes
ACL SAVE

Then reconnect with the updated credentials.

4Ensure client re-authenticates on reconnection

Some client libraries may not re-send the AUTH command after a network timeout. If you see intermittent "operation not permitted" errors:

Node.js (redis):

javascript
const client = redis.createClient({
  host: "localhost",
  port: 6379,
  password: "your_password",
  // Ensure auth is re-sent on reconnect
});

Python (redis-py):

python
import redis
r = redis.Redis(
    host="localhost",
    port=6379,
    password="your_password",
    decode_responses=True
)

Update to the latest version of your Redis client library.

5Check if you're connecting to a read-only replica

If write operations fail but reads succeed, you may be connected to a replica:

bash
redis-cli
> INFO replication
# Replication
role:slave

If this shows role:slave, you're on a replica. Write operations are not permitted on replicas. Connect to the master instead:

bash
redis-cli -h master_hostname -p 6379
> AUTH password
> SET key value
OK

For applications, ensure your write operations target the master host.

6Fix container permission issues (Docker)

If running Redis in Docker, permission errors may occur when persisting data:

bash
# Ensure data directory exists with correct permissions
sudo mkdir -p ~/redis/data
sudo chown -R 999:999 ~/redis/data
sudo chmod -R 700 ~/redis/data

# Run container with proper volume mount
docker run -d \
  -v ~/redis/data:/data \
  -p 6379:6379 \
  redis:latest

The 999:999 UID/GID is the default Redis user in official images. Verify with:

bash
docker exec <container_id> id

Advanced notes

ACL Best Practices: For production environments, create dedicated users with minimal required permissions rather than using the default user. Use key patterns to scope access (e.g., ~app:* restricts to keys prefixed with app:). Check ACL logs for unauthorized attempts: ACL LOG. Replication Setup: If using Redis replication, always write to the master and read from replicas. Some client libraries support read replicas automatically (like redis-py). TLS/mTLS: If Redis uses TLS certificates, ensure your client is configured for TLS connections as well. Legacy requirepass: Older Redis versions use requirepass in redis.conf instead of ACLs. Both mechanisms can cause this error if misconfigured.

Frequently asked questions

What does "ERR operation not permitted" mean?
Redis returns this error when the requested operation is not allowed under the current security configuration. 0+ ACL (Access Control List) settings, or an attempt to write to a read-only replica instance.
How do I fix "ERR operation not permitted"?
This error occurs when a Redis command is blocked by authentication, ACL permissions, or replica mode restrictions. It typically happens when credentials are missing, user permissions are insufficient, or you're trying to write to a read-only replica.
What causes "ERR operation not permitted"?
Missing or invalid password when connecting to a requirepass-protected Redis server Client library not re-authenticating after connection timeout or reconnection User lacks necessary permissions in Redis ACL configuration
Is the "ERR operation not permitted" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading