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

  1. Restore quota records from a consistent 'juicefs dump' backup
  2. 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
  3. Ensure all clients run a JuiceFS version that writes the same 32-byte quota encoding
  4. 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

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


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/d9b5154c93b3308e. Report an issue: GitHub.