LOADING error
Redis is still loading its data into memory and can't serve the command yet.
Redis returns this error while it's loading your data into memory. This happens when the server starts and reads its data files from disk. It can also happen on a replica while it loads a full copy of the data from its primary. Most commands fail until loading finishes.
LOADING Redis is loading the dataset in memory
In client libraries
| Client library | Exception or error type | Message |
|---|---|---|
| redis-py | BusyLoadingError |
Redis is loading the dataset in memory |
| Jedis | JedisDataException |
LOADING Redis is loading the dataset in memory |
| node-redis | SimpleErrorTest with err.message.startsWith('LOADING') |
LOADING Redis is loading the dataset in memory |
| Lettuce The async API wraps the exception in an ExecutionException (get()) or a CompletionException (join()). |
RedisLoadingException |
LOADING Redis is loading the dataset in memory |
| go-redis | redis.ErrorTest with redis.IsLoadingError(err) |
LOADING Redis is loading the dataset in memory |
| ioredis | ReplyErrorTest with err.message.startsWith('LOADING') |
LOADING Redis is loading the dataset in memoryBy default ioredis waits while the server loads its data, so the command doesn't fail. Set enableReadyCheck: false to get this error. |
| StackExchange.Redis NRedisStack uses StackExchange.Redis, so it raises the same exceptions. The sync and async APIs raise the same exceptions. |
RedisServerException |
LOADING Redis is loading the dataset in memory |
| Predis | Predis\Response\ServerExceptionTest with $e->getErrorType() === 'LOADING' |
LOADING Redis is loading the dataset in memory |
| redis-rb | Redis::CommandError |
LOADING Redis is loading the dataset in memory (redis://<host>:<port>) |
| redis-rs The sync and async APIs raise the same errors. |
ErrorKind::Server(ServerErrorKind::BusyLoading) |
BusyLoading: Redis is loading the dataset in memory |
Example
Most commands, including PING, return this error while Redis is loading. A few commands, such as INFO, still work:
> GET mykey
(error) LOADING Redis is loading the dataset in memory
> PING
(error) LOADING Redis is loading the dataset in memory
> INFO persistence
# Persistence
loading:1
...
How to fix it
Wait for loading to finish, and then send the command again. The bigger your dataset is, the longer loading takes. To follow the progress, run INFO persistence. loading:1 means that Redis is still loading, and loading_eta_seconds estimates the time left.
In your app, treat this error as temporary, and retry the command after a delay. See Retry with backoff.