{"record":{"id":"078756dc5313165f","repo":"juicedata/juicefs","slug":"invalid-quota-command-d","errorCode":null,"errorMessage":"invalid quota command: %d","messagePattern":"invalid quota command: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/quota.go","lineNumber":620,"sourceCode":"\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}\n}\n\nfunc (m *baseMeta) handleQuotaSet(ctx Context, qtype uint32, key uint64, dpath string, quotas map[string]*Quota, strict bool) error {\n\tformat := m.getFormat()\n\tvar quota *Quota\n\tvar scan bool = false\n\tswitch qtype {\n\tcase DirQuotaType:\n\t\tif !format.DirStats {\n\t\t\tformat.DirStats = true\n\t\t\terr := m.en.doInit(format, false)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Warnf(\"init dir stats: %s\", err)\n\t\t\t}\n\t\t}\n\t\tquota = quotas[dpath]\n\tcase UserQuotaType:","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/quota.go#L602-L638","documentation":"HandleQuota received a quota sub-command value it does not recognize. Valid commands are set/get/del/list/check; anything else falls through to the default branch and reports the numeric command value.","triggerScenarios":"An internal caller or API consumer passes an undefined QuotaCmd value into HandleQuota (the CLI normally constrains choices, so this usually indicates a programmatic misuse or version mismatch between caller and library).","commonSituations":"Third-party tooling or scripts driving the meta API with a hand-rolled command constant; a binary built against mismatched juicefs library versions where a new command is sent to an older implementation.","solutions":["Use one of the supported commands: set, get, del, list, check.","Rebuild/redeploy so the caller and the juicefs library are the same version.","If adding a new command, extend the switch in HandleQuota and the CLI flag validation together."],"exampleFix":"// before\nerr = m.HandleQuota(ctx, DirQuotaType, 999 /*unknown cmd*/, \"/data\", ...)\n// after\nerr = m.HandleQuota(ctx, DirQuotaType, QuotaSet, \"/data\", ...)","handlingStrategy":"validation","validationCode":"case \"$CMD\" in set|get|del|list|check) ;; *) echo \"unsupported quota command: $CMD\"; exit 1;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict inputs to the documented set/get/del/list/check commands.","Keep caller and library versions aligned when driving the meta API programmatically.","Use the CLI flags rather than calling internal APIs directly."],"tags":["quota","api","invalid-command"],"backgroundTag":"invalid-enum-value","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"}