juicedata/juicefs · error
Database redis://%s is not empty
Error message
Database redis://%s is not empty
What it means
Returned by LoadMeta (redis.go:5197) for a non-cluster Redis target: DBSize() reports more than 0 keys, so the destination database is not empty. LoadMeta refuses to proceed because loading a dump into a non-empty DB would produce a corrupted merge of two metadata sets.
Source
Thrown at pkg/meta/redis.go:5197
tryExec()
}
func (m *redisMeta) LoadMeta(r io.Reader) (err error) {
ctx := Background()
if _, ok := m.rdb.(*redis.ClusterClient); ok {
err = m.scan(ctx, "*", func(keys []string) error {
return fmt.Errorf("found key with same prefix: %s", keys[0])
})
if err != nil {
return err
}
} else {
dbsize, err := m.rdb.DBSize(ctx).Result()
if err != nil {
return err
}
if dbsize > 0 {
return fmt.Errorf("Database redis://%s is not empty", m.addr)
}
}
p := m.rdb.TxPipeline()
tryExec := func() {
if p.Len() > 1000 {
if rs, err := p.Exec(ctx); err != nil {
for i, r := range rs {
if r.Err() != nil {
logger.Errorf("failed command %d %+v: %s", i, r, r.Err())
break
}
}
panic(err)
}
}
}
defer func() {View on GitHub (pinned to c9a67b23e8)
Solutions
- Use an empty Redis DB (fresh instance or an unused DB number) as the load target.
- If the existing keys are disposable, run FLUSHDB on the target DB and retry.
- Verify the Redis URL/DB index in your command points to the intended destination.
- If a previous load partially completed, flush and re-load from the original dump to avoid a mixed state.
Example fix
// before juicefs load redis://shared:6379/0 backup.json // DB 0 in use // after redis-cli -h shared -n 0 flushdb juicefs load redis://shared:6379/0 backup.json
Defensive patterns
Strategy: validation
Validate before calling
// shell: refuse to load into a non-empty DB
dbsize=$(redis-cli -h target -p 6379 -n 0 dbsize)
[ "$dbsize" = "0" ] || { echo "DB not empty ($dbsize keys)"; exit 1; } Try / catch
if err := meta.LoadMeta(ctx, r); err != nil {
if strings.Contains(err.Error(), "is not empty") {
// pick an empty DB index or FLUSHDB the target, then retry
}
return err
} Prevention
- Load into a dedicated, empty Redis instance or unused DB index.
- FLUSHDB the target before every restore in scripts.
- Never point `juicefs load` at a live volume's metadata URL.
- After a failed load, flush before retrying — partial keys remain.
When it happens
Trigger: Running `juicefs load` against a standalone Redis URL whose selected DB already contains keys (e.g. an existing volume's metadata, or leftover keys from a previous load).
Common situations: Restoring over a live volume; loading into DB 0 of a shared Redis server; a failed/partial previous load leaving keys behind.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- found key with same prefix: %s
- database redis://%s is not empty
- found key with same prefix: %s
- database %s is used by volume %s
- load setting: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/530f8a3483782cdf.
Report an issue: GitHub.