redis Errors

39 error patterns

redis3 fixes

Redis operation on wrong data type

Redis.*WRONGTYPE Operation against a key holding the wrong kind of value

  • Check key type with TYPE command before operating
  • Delete and recreate key if type needs to change
redis3 fixes

Redis cluster is down

Redis.*CLUSTERDOWN.*The cluster is down

  • Check cluster health: redis-cli --cluster check <host>:<port>
  • Verify all master nodes have sufficient slots assigned
redis3 fixes

Redis cluster CROSSSLOT error

Redis.*ERR Error running script.*CROSSSLOT Keys in request don't hash to the same slot

  • Use hash tags to force keys to same slot: {user:1}:profile, {user:1}:settings
  • Split multi-key operation into per-slot operations
redis3 fixes

Redis still loading dataset into memory

Redis.*LOADING Redis is loading the dataset in memory

  • Wait for Redis to finish loading (check with INFO persistence)
  • Reduce dataset size or increase memory for faster load
redis3 fixes

Redis out of memory - maxmemory exceeded

Redis.*OOM command not allowed when used memory > 'maxmemory'

  • Increase maxmemory in redis.conf
  • Set eviction policy: maxmemory-policy allkeys-lru
redis3 fixes

Redis cluster slot already being migrated

Redis.*ERR Slot.*is already busy

  • Complete or cancel the in-progress migration first
  • Use CLUSTER SETSLOT <slot> STABLE on both nodes to reset
redis3 fixes

Redis JSON module command not available

Redis.*ERR unknown command.*JSON\.

  • Load RedisJSON module: loadmodule /path/to/rejson.so
  • Upgrade to Redis Stack which includes JSON module
redis3 fixes

Redis script not cached for EVALSHA

Redis.*NOSCRIPT No matching script.*EVALSHA

  • Use EVAL instead of EVALSHA for the first call
  • Catch NOSCRIPT error and fall back to EVAL with full script
redis3 fixes

Redis write command sent to replica

Redis.*READONLY.*can't write against a read only replica

  • Connect to the master node for write operations
  • Use Redis client library with master/replica awareness
redis3 fixes

Redis Stream XADD MAXLEN invalid value

Redis.*ERR XADD.*MAXLEN.*must be positive

  • Use a positive integer for MAXLEN: XADD stream MAXLEN 1000 * field value
  • Use ~ for approximate trimming: MAXLEN ~ 1000
redis3 fixes

Redis Stream consumer group doesn't exist

Redis.*ERR XREADGROUP.*NOGROUP.*No such.*consumer group

  • Create consumer group first: XGROUP CREATE stream group_name $ MKSTREAM
  • Use 0 instead of $ for group start ID to read from beginning
redis3 fixes

Redis invalid expire time

Redis.*ERR invalid expire time.*SETEX

  • Ensure expire time is a positive integer (seconds for SETEX)
  • Use PSETEX for millisecond precision
redis3 fixes

Redis transaction aborted due to error in MULTI block

Redis.*EXECABORT.*Transaction discarded because of previous errors

  • Fix the command that caused the error within the MULTI block
  • Check all commands are valid before EXEC
redis3 fixes

Redis busy with long-running script

Redis.*BUSY.*Redis is busy running a script

  • Optimize the Lua script to run faster
  • Use SCRIPT KILL to terminate a read-only script
redis3 fixes

Redis Bloom filter doesn't exist

Redis.*ERR.*BF\.ADD.*not an existing.*Bloom Filter

  • Create Bloom filter first: BF.RESERVE key error_rate capacity
  • Use BF.ADD which auto-creates with default parameters
redis3 fixes

Redis Top-K structure not initialized

Redis.*ERR.*TOPK\.ADD.*requires.*Top-K.*structure

  • Initialize with TOPK.RESERVE key topk width depth decay
  • Load Redis probabilistic data structures module
redis3 fixes

Redis cluster MOVED redirect

Redis.*MOVED (\d+) .*:.*

  • Use a cluster-aware client that handles MOVED automatically
  • Update slot-to-node mapping: CLUSTER SLOTS or CLUSTER SHARDS
redis3 fixes

Redis cluster ASK redirect during migration

Redis.*ASK (\d+) .*:.*

  • Send ASKING command to target node before retrying the command
  • Use cluster-aware client that handles ASK automatically
redis3 fixes

Redis Count-Min Sketch initialization error

Redis.*ERR.*CMS\.INITBYDIM.*not a valid.*Count-Min Sketch

  • Initialize with CMS.INITBYDIM key width depth
  • Or use CMS.INITBYPROB key error probability
redis3 fixes

Redis WRONGTYPE operation on wrong data structure

WRONGTYPE Operation against a key holding the wrong kind of value

  • Check key's type with TYPE command before operating on it
  • Delete the key and recreate with correct type if data structure changed
redis3 fixes

Redis connection refused

ECONNREFUSED.*6379|Redis.*connection.*refused|connect ECONNREFUSED

  • Verify Redis server is running: redis-cli ping
  • Check host and port in connection config (default: localhost:6379)
redis3 fixes

Redis max memory limit reached

OOM command not allowed.*maxmemory|maxmemory.*reached

  • Configure an eviction policy: maxmemory-policy allkeys-lru
  • Increase maxmemory in redis.conf or use CONFIG SET
redis3 fixes

Redis serialization error

ReplyError.*ERR.*serialize|circular.*JSON.*redis

  • Serialize complex objects with JSON.stringify() before storing
  • Check for circular references in objects before caching
redis3 fixes

Redis pub/sub subscriber mode command error

subscriber.*cannot.*command|Connection in subscriber mode

  • Use separate Redis client instances for pub/sub and regular commands
  • The subscriber client can only use SUBSCRIBE/UNSUBSCRIBE/PSUBSCRIBE after subscribing
redis3 fixes

Redis authentication failure

NOAUTH.*Authentication required|ERR.*AUTH.*failed|invalid password

  • Pass password in connection config: { password: 'your-password' }
  • For Redis 6+ ACLs, provide both username and password
redis3 fixes

Redis Cluster cross-slot key error

CROSSSLOT.*Keys.*different.*slot|MOVED.*cluster

  • Use hash tags {prefix} in key names to ensure related keys map to same slot
  • Don't use multi-key commands (MGET, MSET) across different slots
redis3 fixes

Redis transaction (MULTI/EXEC) error

EXECABORT.*Transaction.*error|MULTI.*EXEC.*failed

  • Check all commands in the transaction are valid before EXEC
  • Use WATCH for optimistic locking — transaction aborts if watched key changes
redis3 fixes

Redis server busy loading data

LOADING.*Redis.*loading.*dataset|BUSY.*background save

  • Wait for Redis to finish loading the RDB/AOF file before connecting
  • Implement connection retry with exponential backoff on LOADING error
redis3 fixes

Redis Lua script timeout

ERR.*Lua.*script.*timeout|BUSY.*script.*kill

  • Optimize Lua scripts to avoid long-running operations
  • Increase lua-time-limit config if the script legitimately needs more time
redis3 fixes

Redis Streams consumer group error

ERR.*stream.*not exist|XREAD.*timeout|consumer group.*not found

  • Create the stream and consumer group before reading: XGROUP CREATE mystream grp $ MKSTREAM
  • Handle NOGROUP error by auto-creating the group on first use
redis3 fixes

Redis client connection closed unexpectedly

AbortError.*connection.*closed|ClientClosedError|Socket.*closed

  • Enable auto-reconnect in client config (reconnectStrategy in ioredis/node-redis)
  • Handle 'error' and 'reconnecting' events on the client for graceful degradation
redis3 fixes

Redis background save failure

MISCONF.*BGSAVE.*error|Can't.*save.*background

  • Check disk space — Redis needs free space for RDB snapshot writes
  • Set stop-writes-on-bgsave-error no if persistence isn't critical
redis3 fixes

Redis max clients limit reached

ERR.*max.*clients.*reached|too many connections|maxclients

  • Increase maxclients in redis.conf (default 10000)
  • Use connection pooling in your application (e.g., generic-pool)
redis3 fixes

Redis invalid TTL/expire value

ERR.*invalid expire time|ERR.*timeout.*negative

  • Ensure TTL is a positive integer (seconds for EXPIRE, milliseconds for PEXPIRE)
  • Check that the value isn't NaN or undefined before passing to expire command
redis3 fixes

Redis EVALSHA script not in cache

NOSCRIPT.*No matching script|EVALSHA.*script not cached

  • Fall back to EVAL with full script when EVALSHA returns NOSCRIPT
  • Use SCRIPT LOAD on application startup to pre-cache scripts
redis3 fixes

Redis pub/sub message size issue

ERR.*Pub/Sub.*message.*too large|message.*exceeds.*limit

  • Keep pub/sub messages small — send IDs/references, not full payloads
  • Compress large messages before publishing (gzip/lz4)
redis3 fixes

Redis write to replica/slave error

READONLY.*cluster.*slave|READONLY.*replica.*not accept writes

  • Direct write operations to the master node, not replicas
  • Use a cluster-aware client that routes writes to master automatically
redis3 fixes

Redis SCAN cursor error

ERR.*scan.*cursor.*invalid|SCAN.*iteration.*error

  • Always start SCAN with cursor 0 and continue until server returns 0
  • Don't reuse cursors from previous SCAN iterations after reconnection
redis3 fixes

Redis Sentinel master discovery failure

ERR.*sentinel.*master.*not found|Sentinel.*failover.*error

  • Verify sentinel nodes are running and can reach the Redis master
  • Check master name in client config matches sentinel's monitored master name