juicedata/juicefs · error

parse quota key %q: %s

Error message

parse quota key %q: %s

What it means

For user or group quotas, HandleQuota parses the quota key as an unsigned 64-bit integer (uid/gid). The provided key is not a valid numeric ID, so parsing fails and the original strconv error is wrapped into this message.

Source

Thrown at pkg/meta/quota.go:603

func (m *baseMeta) HandleQuota(ctx Context, cmd uint8, qkey string, qtype uint32, quotas map[string]*Quota, strict, repair bool, create bool) error {
	var inode Ino
	var dpath string
	var key uint64

	if qtype == DirQuotaType && cmd != QuotaList {
		dpath = qkey
		if st := m.resolve(ctx, dpath, &inode, create); st != 0 {
			return fmt.Errorf("resolve dir %s: %s", dpath, st)
		}
		if inode.IsTrash() {
			return errors.New("no quota for any trash directory")
		}
		key = uint64(inode)
	} else if (qtype == UserQuotaType || qtype == GroupQuotaType) && cmd != QuotaCheck {
		id, err := strconv.ParseUint(qkey, 10, 64)
		if err != nil {
			return fmt.Errorf("parse quota key %q: %s", qkey, err)
		}
		key = id
	}

	switch cmd {
	case QuotaSet:
		return m.handleQuotaSet(ctx, qtype, key, dpath, quotas, strict)
	case QuotaGet:
		return m.handleQuotaGet(ctx, qtype, key, dpath, quotas)
	case QuotaDel:
		return m.en.doDelQuota(ctx, qtype, key)
	case QuotaList:
		return m.handleQuotaList(ctx, qtype, key, quotas)
	case QuotaCheck:
		return m.handleQuotaCheck(ctx, qtype, key, dpath, strict, repair, quotas)
	default:
		return fmt.Errorf("invalid quota command: %d", cmd)
	}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Resolve the user/group to a numeric ID first: `id -u alice`, `getent group devs`.
  2. Re-run the quota command with the numeric uid/gid.
  3. Check the argument for stray characters, quotes, or out-of-range values.

Example fix

// before
juicefs quota set sqlite3://m.db --uid alice --capacity 5G
// after
juicefs quota set sqlite3://m.db --uid 1001 --capacity 5G
Defensive patterns

Strategy: validation

Validate before calling

UID_NUM=$(id -u "$USER_NAME") || exit 1
case "$UID_NUM" in ''|*[!0-9]*) echo "not a numeric uid"; exit 1;; esac

Prevention

When it happens

Trigger: Running `juicefs quota set/get/del --uid <key>` or `--gid <key>` where the key is non-numeric, negative, or exceeds uint64 range (e.g. `--uid alice` instead of a numeric uid).

Common situations: Passing a username or group name instead of the numeric uid/gid; quoting mistakes leaving stray characters in the argument; copying an ID with whitespace or leading '+' signs.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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