juicedata/juicefs · error
database redis://%s is not empty
Error message
database redis://%s is not empty
What it means
prepareLoad guards `juicefs load` against overwriting live data: for standalone Redis/Sentinel it checks DBSize and refuses to proceed if the database holds any keys. Loading into a non-empty Redis would corrupt or interleave metadata.
Source
Thrown at pkg/meta/redis_bak.go:995
return execPipe(ctx, pipe)
}
func (m *redisMeta) prepareLoad(ctx Context, opt *LoadOption) error {
opt.check()
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)
}
}
return nil
}
View on GitHub (pinned to c9a67b23e8)
Solutions
- Use a dedicated empty Redis DB: pass a distinct DB index (redis://host:6379/1) or a fresh instance.
- Flush the target: redis-cli -n <db> FLUSHDB (confirm nothing else uses it first).
- If the leftover keys are from a failed prior load, delete only that volume's prefix keys.
- Verify the --meta URL points at the intended host/port/db before loading.
Example fix
// before juicefs load -i backup.json redis://10.0.0.5:6379/0 # DB 0 has keys // after redis-cli -h 10.0.0.5 -n 0 DBSIZE # verify, then flush if safe redis-cli -h 10.0.0.5 -n 0 FLUSHDB juicefs load -i backup.json redis://10.0.0.5:6379/0
Defensive patterns
Strategy: validation
Validate before calling
n, err := rdb.DBSize(ctx).Result()
if err != nil { return err }
if n > 0 { return fmt.Errorf("abort: target DB has %d keys", n) } Try / catch
if err := load(ctx, meta, f); err != nil {
if strings.Contains(err.Error(), "is not empty") {
log.Fatalf("refusing to load into non-empty DB; flush or choose another DB index: %v", err)
}
return err
} Prevention
- Dedicate a Redis DB index (or instance) to each restore.
- Verify DBSize == 0 before every load.
- Do not share a Redis instance between JuiceFS volumes without distinct DB indexes/prefixes.
- Confirm the meta URL (host, port, db index) before running load.
When it happens
Trigger: Running `juicefs load -i dump.json redis://host:port/vol` when the target DB already contains keys — a previous volume, another JuiceFS instance, or leftover keys from an aborted load.
Common situations: Restoring a backup over an existing volume by mistake; reusing a Redis instance shared with other applications; DB index selection (e.g. redis://host:6379/0 vs /1) pointing at an occupied database.
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
- Database redis://%s is not empty
- found key with same prefix: %s
- 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/01f61564490c154d.
Report an issue: GitHub.