{"record":{"id":"f297102997b6b2e2","repo":"juicedata/juicefs","slug":"parse-quota-key-q-s","errorCode":null,"errorMessage":"parse quota key %q: %s","messagePattern":"parse quota key %q: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/quota.go","lineNumber":603,"sourceCode":"\nfunc (m *baseMeta) HandleQuota(ctx Context, cmd uint8, qkey string, qtype uint32, quotas map[string]*Quota, strict, repair bool, create bool) error {\n\tvar inode Ino\n\tvar dpath string\n\tvar key uint64\n\n\tif qtype == DirQuotaType && cmd != QuotaList {\n\t\tdpath = qkey\n\t\tif st := m.resolve(ctx, dpath, &inode, create); st != 0 {\n\t\t\treturn fmt.Errorf(\"resolve dir %s: %s\", dpath, st)\n\t\t}\n\t\tif inode.IsTrash() {\n\t\t\treturn errors.New(\"no quota for any trash directory\")\n\t\t}\n\t\tkey = uint64(inode)\n\t} else if (qtype == UserQuotaType || qtype == GroupQuotaType) && cmd != QuotaCheck {\n\t\tid, err := strconv.ParseUint(qkey, 10, 64)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"parse quota key %q: %s\", qkey, err)\n\t\t}\n\t\tkey = id\n\t}\n\n\tswitch cmd {\n\tcase QuotaSet:\n\t\treturn m.handleQuotaSet(ctx, qtype, key, dpath, quotas, strict)\n\tcase QuotaGet:\n\t\treturn m.handleQuotaGet(ctx, qtype, key, dpath, quotas)\n\tcase QuotaDel:\n\t\treturn m.en.doDelQuota(ctx, qtype, key)\n\tcase QuotaList:\n\t\treturn m.handleQuotaList(ctx, qtype, key, quotas)\n\tcase QuotaCheck:\n\t\treturn m.handleQuotaCheck(ctx, qtype, key, dpath, strict, repair, quotas)\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid quota command: %d\", cmd)\n\t}","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/quota.go#L585-L621","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Resolve the user/group to a numeric ID first: `id -u alice`, `getent group devs`.","Re-run the quota command with the numeric uid/gid.","Check the argument for stray characters, quotes, or out-of-range values."],"exampleFix":"// before\njuicefs quota set sqlite3://m.db --uid alice --capacity 5G\n// after\njuicefs quota set sqlite3://m.db --uid 1001 --capacity 5G","handlingStrategy":"validation","validationCode":"UID_NUM=$(id -u \"$USER_NAME\") || exit 1\ncase \"$UID_NUM\" in ''|*[!0-9]*) echo \"not a numeric uid\"; exit 1;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve names to numeric uid/gid in scripts before invoking quota commands.","Validate arguments are pure digits within uint64 range.","Avoid copy-pasting IDs with surrounding whitespace or quotes."],"tags":["quota","cli","parsing"],"backgroundTag":"invalid-cli-argument","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}