{"record":{"id":"7f9f8059d970c183","repo":"juicedata/juicefs","slug":"failed-to-load-s-quotas-w","errorCode":null,"errorMessage":"failed to load %s quotas: %w","messagePattern":"failed to load (.+?) quotas: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/redis.go","lineNumber":4541,"sourceCode":"\tquotaTypes := []struct {\n\t\tenabled bool\n\t\tqtype   uint32\n\t\tname    string\n\t\tquotas  map[uint64]*Quota\n\t}{\n\t\t{format.DirStats, DirQuotaType, \"dir\", dirQuotas},\n\t\t{format.UserGroupQuota, UserQuotaType, \"user\", userQuotas},\n\t\t{format.UserGroupQuota, GroupQuotaType, \"group\", groupQuotas},\n\t}\n\n\tfor _, qt := range quotaTypes {\n\t\tif !qt.enabled {\n\t\t\tcontinue\n\t\t}\n\n\t\tconfig, err := m.getQuotaKeys(qt.qtype)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, fmt.Errorf(\"failed to load %s quotas: %w\", qt.name, err)\n\t\t}\n\n\t\tusedInodesMap, err := m.hscanToMap(ctx, config.usedInodesKey)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, err\n\t\t}\n\t\tusedSpaceMap, err := m.hscanToMap(ctx, config.usedSpaceKey)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, err\n\t\t}\n\t\tquotaMap, err := m.hscanToMap(ctx, config.quotaKey)\n\t\tif err != nil {\n\t\t\treturn nil, nil, nil, err\n\t\t}\n\n\t\tfor key, usedInodesStr := range usedInodesMap {\n\t\t\tid, err := strconv.ParseUint(key, 10, 64)\n\t\t\tif err != nil {","sourceCodeStart":4523,"sourceCodeEnd":4559,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/redis.go#L4523-L4559","documentation":"Wrapped error from loadQuotas (redis.go:4541). While loading all user/group (or dir) quotas, the call to getQuotaKeys for a quota type failed, and the underlying error is wrapped as \"failed to load %s quotas\". getQuotaKeys itself returns an error only when the quota type is unknown/unsupported, so this almost always indicates an internal inconsistency rather than bad user input.","triggerScenarios":"Calling loadQuotas (quota listing/sync path) when m.getQuotaKeys(qt.qtype) returns an error for an enabled quota type in the qtype list.","commonSituations":"A new quota type was enabled in the enabledQuotas list but getQuotaKeys was not extended to return key names for it; mixed-version client code where a newer client enumerates a quota type the loaded code does not map.","solutions":["Read the wrapped inner error (%w) to see why getQuotaKeys failed and fix the root cause.","If you patched the code and added a quota type to the enabled list, add the corresponding case in getQuotaKeys.","Ensure all clients mounting the volume are the same version so the quota-type table is consistent.","Restart with a stock JuiceFS build to rule out a local modification causing the mismatch."],"exampleFix":"// before\n// enabled: DirQuotaType, UserQuotaType, NewCustomType // getQuotaKeys has no case\n// after\n// add case NewCustomType in getQuotaKeys, or remove it from the enabled list","handlingStrategy":"try-catch","validationCode":"// ensure every enabled quota type has a getQuotaKeys mapping before starting\nfor _, qt := range enabledQuotas {\n    if _, err := m.getQuotaKeys(qt.qtype); err != nil { return err }\n}","typeGuard":"func supportedQuotaType(t uint32) bool { return t == UserQuotaType || t == GroupQuotaType || t == DirQuotaType }","tryCatchPattern":"quotas, used, pending, err := m.loadQuotas(ctx)\nif err != nil {\n    var wrapped interface{ Unwrap() error }\n    if errors.As(err, &inner) { log.Printf(\"quota key lookup failed: %v\", inner) }\n    return err\n}","preventionTips":["Never add a quota type to the enabled list without extending getQuotaKeys.","Run the same JuiceFS client version across all mount points.","Check the inner (%w) error first — this wrapper only names the quota type."],"tags":["redis","quota","metadata"],"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"}