juicedata/juicefs · error
invalid quota value: %v
Error message
invalid quota value: %v
What it means
doGetQuota reads a quota record from the KV store and requires exactly 32 bytes (four packed big-endian int64s: MaxInodes, MaxSpace, UsedInodes, UsedSpace). Any other non-nil length means the stored value is corrupt or written by an incompatible format, so parsing is refused.
Source
Thrown at pkg/meta/tkv.go:3504
return nil, fmt.Errorf("invalid quota type: %d", qtype)
}
}
func (m *kvMeta) doGetQuota(ctx Context, qtype uint32, key uint64) (*Quota, error) {
quotaKey, err := m.getQuotaKey(qtype, key)
if err != nil {
return nil, err
}
buf, err := m.get(quotaKey)
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
if len(buf) != 32 {
return nil, fmt.Errorf("invalid quota value: %v", buf)
}
return m.parseQuota(buf), nil
}
func (m *kvMeta) doSetQuota(ctx Context, qtype uint32, key uint64, quota *Quota) (bool, error) {
quotaKey, err := m.getQuotaKey(qtype, key)
if err != nil {
return false, err
}
var created bool
err = m.txn(ctx, func(tx *kvTxn) error {
buf := tx.get(quotaKey)
var origin *Quota
var exists bool
if len(buf) == 32 {
origin = m.parseQuota(buf)View on GitHub (pinned to c9a67b23e8)
Solutions
- Restore quota records from a consistent 'juicefs dump' backup
- Inspect the offending quota key's value length in the KV store and re-set the quota with juicefs quota to overwrite the corrupt value
- Ensure all clients run a JuiceFS version that writes the same 32-byte quota encoding
- Delete the corrupt quota key and recreate the quota with 'juicefs quota set'
Defensive patterns
Strategy: try-catch
Validate before calling
// check quota reads succeed before relying on them
q, err := meta.GetQuota(ctx, qtype, key)
if err != nil && strings.Contains(err.Error(), "invalid quota value") {
// restore or re-set the quota
} Try / catch
if _, err := doGetQuota(ctx, qtype, key); err != nil {
if strings.Contains(err.Error(), "invalid quota value") {
// delete the corrupt key and re-set quota via CLI
}
} Prevention
- Restore metadata only from complete dumps of the same JuiceFS version
- Never manually edit quota records in the KV store
- Re-set quotas after any partial restore
- Monitor for failed/partial writes if the KV store lacks transactions
When it happens
Trigger: Reading a user/group/dir quota ('QU'/'QG'/'QD' prefixed key) whose value length is not 32 bytes — e.g. after a bad restore, manual edit, or cross-version record format change.
Common situations: Metadata restored from a dump of a different JuiceFS version; hand-edited KV records; partial writes from a crashed client (if the store lacks transactional guarantees).
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- invalid value for delayed slices %q: %v
- invalid key %x
- failed to load %q quotas: %w
- set total inodes: %w
- invalid sustainedKey: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/d9b5154c93b3308e.
Report an issue: GitHub.