juicedata/juicefs · error
quota of %s is inconsistent, please repair it with --repair
Error message
quota of %s is inconsistent, please repair it with --repair flag
What it means
Raised by baseMeta.checkDirUsage (pkg/meta/quota.go:975) when the quota record's stored usage (UsedInodes/UsedSpace) differs from the live summary computed by GetSummary, and the check was run without --repair. It is a consistency-check failure: the metadata engine's cached quota usage has drifted from actual filesystem contents.
Source
Thrown at pkg/meta/quota.go:975
humanize.Comma(q.UsedInodes), humanize.IBytes(uint64(q.UsedSpace)),
humanize.Comma(usedInodes), humanize.IBytes(uint64(usedSpace)),
)
if repair {
q.UsedInodes = usedInodes
q.UsedSpace = usedSpace
quotas[dpath] = q
logger.Info("repairing...")
_, err = m.en.doSetQuota(ctx, qtype, key, &Quota{
MaxInodes: -1,
MaxSpace: -1,
UsedInodes: q.UsedInodes,
UsedSpace: q.UsedSpace,
})
return err
}
return fmt.Errorf("quota of %s is inconsistent, please repair it with --repair flag", dpath)
}
func (m *baseMeta) compareUGUsage(usageMap map[uint64]*Summary, quotaMap map[uint64]*Quota, qtype uint32, retQuotas map[string]*Quota) bool {
var hasErr bool
idType := "uid"
if qtype == GroupQuotaType {
idType = "gid"
}
for id, usage := range usageMap {
usedSpace := int64(usage.Size)
usedInodes := int64(usage.Files)
q, ok := quotaMap[id]
if !ok {
logger.Warnf("%s:%d: quota not found, actual usage(%s, %s)",
idType, id, humanize.Comma(usedInodes), humanize.IBytes(uint64(usedSpace)))
hasErr = true
continue
}View on GitHub (pinned to c9a67b23e8)
Solutions
- Re-run with the --repair flag: `juicefs quota check <path> --repair`; this rewrites UsedInodes/UsedSpace from the fresh summary via doSetQuota.
- Inspect the logged warning just before the error (quota(...) != summary(...)) to gauge the drift magnitude before repairing.
- If drift recurs, check for mixed client versions / known quota bugs and upgrade all clients.
- Verify no other writes are mutating the tree during check/repair to avoid a new race.
Example fix
// before $ juicefs quota check /mnt/jfs/data // ERROR: quota of /mnt/jfs/data is inconsistent, please repair it with --repair flag // after $ juicefs quota check /mnt/jfs/data --repair
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-compute expected usage to detect drift before official check
var sum meta.Summary
if st := m.GetSummary(ctx, ino, &sum, true, false); st == 0 {
if q.UsedInodes != int64(sum.Dirs+sum.Files)-1 || q.UsedSpace != int64(sum.Size)-int64(4096) {
logger.Warn("quota drift detected; run check with --repair")
}
} Try / catch
if err := quotaCheck(path, false); err != nil && strings.Contains(err.Error(), "--repair flag") {
err = quotaCheck(path, true) // retry in repair mode
} Prevention
- Schedule periodic `juicefs quota check --repair` to self-heal drift.
- Upgrade all clients to the same version to avoid accounting bugs.
- Avoid restoring metadata from old backups without a subsequent quota repair.
When it happens
Trigger: `juicefs quota check <path>` (without --repair) where q.UsedInodes != sum-based usedInodes or q.UsedSpace != usedSpace, e.g. after crashes, rollback of metadata, or bugs that missed quota accounting updates.
Common situations: Metadata engine restored from an old backup; a crash between data write and quota update; clients running older versions that mishandled quota increments; deleted files not decrementing usage due to a bug.
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
- user/group quota is inconsistent, please repair it with --re
- failed to get startTS, which is required for TiKV to ensure
- no quota for inode %d path %s
- clean %s quotas: %w
- set %s quota: %w
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/ce0a2a072c13d792.
Report an issue: GitHub.