juicedata/juicefs · error
cannot disable dir stats when there are still %d dir quotas:
Error message
cannot disable dir stats when there are still %d dir quotas: %v
What it means
`juicefs config` refuses to disable directory-level stats (`--stats=false`) while the volume still has directory quotas defined. Dir stats are the accounting backbone for dir quotas, so the command fails fast instead of silently breaking quota usage tracking. The error lists how many quotas remain and their paths.
Source
Thrown at cmd/config.go:489
}
if trash && format.TrashDays == 0 {
warn("The current trash will be emptied and future removed files will purged immediately.")
if !yes && !userConfirmed() {
return fmt.Errorf("Aborted.")
}
}
if originDirStats && !format.DirStats {
qs := make(map[string]*meta.Quota)
err := m.HandleQuota(meta.Background(), meta.QuotaList, "", meta.DirQuotaType, qs, false, false, false)
if err != nil {
return errors.Wrap(err, "list quotas")
}
if len(qs) != 0 {
paths := make([]string, 0, len(qs))
for path := range qs {
paths = append(paths, path)
}
return fmt.Errorf("cannot disable dir stats when there are still %d dir quotas: %v", len(qs), paths)
}
}
if clientVer {
confirmClientVer := false
if format.CheckVersion() != nil {
warn("Clients below version %s will be rejected after modification.", format.MinClientVersion)
confirmClientVer = true
}
// check all clients
if sessions, err := m.ListSessions(); err == nil {
warnMsg := ""
for _, session := range sessions {
if err := format.CheckCliVersion(version.Parse(session.Version)); err != nil {
warnMsg += fmt.Sprintf("host %s pid %d client version error: %s\n", session.HostName, session.ProcessID, err)
}
}
if warnMsg != "" {View on GitHub (pinned to c9a67b23e8)
Solutions
- Delete the remaining dir quotas first with `juicefs quota remove <path>` for each listed path, then disable dir stats.
- Re-enable dir stats if quotas are still needed (they cannot work without stats).
- Use `--force` to skip the safety check only if you accept that quota usage reporting will be broken.
Example fix
// before juicefs config sqlite3://test.db --stats=false // error: cannot disable dir stats when there are still 2 dir quotas: [/a /b] // after juicefs quota remove /mnt/jfs/a && juicefs quota remove /mnt/jfs/b juicefs config sqlite3://test.db --stats=false
Defensive patterns
Strategy: validation
Validate before calling
quotas=$(juicefs quota list $META 2>/dev/null | wc -l) if [ "$quotas" -gt 0 ]; then echo "Remove dir quotas before disabling stats" exit 1 fi juicefs config $META --stats=false
Prevention
- List dir quotas with `juicefs quota list` before toggling dir stats.
- Treat dir stats as a prerequisite of dir quotas; never disable them while quotas exist.
- Use `--force` consciously and document the tradeoff in runbooks.
When it happens
Trigger: Running `juicefs config <META> --stats=false` when `HandleQuota(QuotaList, DirQuotaType)` returns one or more existing dir quotas, without `--force`.
Common situations: Operators set per-directory quotas (e.g. `juicefs quota set /mnt/jfs/subdir --capacity ...`) and later try to turn off dir stats for performance, forgetting the quotas still depend on it.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- New quota is too small (used / quota): %d / %d bytes, %d / %
- invalid unit
- Aborted.
- parse quota key %q: %s
- user/group quota is inconsistent, please repair it with --re
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/003668c6d1d9f17b.
Report an issue: GitHub.