{"record":{"id":"4f0e0e27b810249b","repo":"juicedata/juicefs","slug":"invalid-tier-id-d","errorCode":null,"errorMessage":"invalid tier id: %d","messagePattern":"invalid tier id: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/azure.go","lineNumber":150,"sourceCode":"\t\tblobClient := b.azblobCli.ServiceClient().NewContainerClient(b.cName).NewBlobClient(src)\n\t\tif t, ok := b.tiers[id]; ok {\n\t\t\ttier := str2Tier(t.Sc)\n\t\t\tif tier == nil {\n\t\t\t\treturn fmt.Errorf(\"tierID:%d not found for %s\", id, src)\n\t\t\t}\n\t\t\tif _, err := blobClient.SetTier(ctx, *tier, &blob2.SetTierOptions{}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif t.Tag != \"\" && ValidateTag(t.Tag) {\n\t\t\t\tparts := strings.SplitN(t.Tag, \"=\", 2)\n\t\t\t\tif len(parts) == 2 {\n\t\t\t\t\tif _, err := blobClient.SetTags(ctx, map[string]string{parts[0]: parts[1]}, nil); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"invalid tier id: %d\", id)\n\t\t}\n\t\treturn nil\n\t}\n\tdstCli := b.container.NewBlobClient(dst)\n\tsrcCli := b.container.NewBlobClient(src)\n\toptions := &blob2.CopyFromURLOptions{}\n\tif b.tiers[0].Sc != \"\" {\n\t\toptions.Tier = str2Tier(b.tiers[0].Sc)\n\t}\n\n\tvar srcURL string\n\tvar err error\n\n\tif b.useTokenAuth {\n\t\t// Token-based authentication: use direct blob URL\n\t\t// Azure will authenticate using the OAuth token from the credential chain\n\t\tsrcURL = srcCli.URL()\n\t\tlogger.Debugf(\"Using token-based authentication for Copy operation (direct URL without SAS)\")","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/azure.go#L132-L168","documentation":"In azure.go Copy(), when a tier id is present in the context (TierKey) and src == dst, the code looks the id up in b.tiers. This error is returned when the id is not present in the configured tiers map at all, so the requested tier operation cannot be resolved to any configured storage class.","triggerScenarios":"Calling Copy (or a write path that sets the tier) with a tier id larger than the configured tiers list, or before any tiers were configured for the Azure backend.","commonSituations":"Client sending --writeback/storage-class tier ids that exceed the number of tiers defined at format time; tiers config omitted while tiered writes are still requested; index off-by-one between writer and configured tiers.","solutions":["Ensure the tier id used by the client exists in the backend's tiers configuration (ids are indexes into the tiers list)","Re-check the volume's tier configuration (`juicefs config <meta-url>`) and add the missing tier entry","Align client-side storage-class values with the configured tier count (valid ids are 0..len(tiers)-1)","Remove the tier request if tiering is not configured for this volume"],"exampleFix":"// before: request tier 2 with only 2 tiers configured (ids 0,1)\nctx = context.WithValue(ctx, TierKey{}, uint8(2))\n// after\nctx = context.WithValue(ctx, TierKey{}, uint8(1))","handlingStrategy":"validation","validationCode":"tierID := uint8(2); if int(tierID) >= len(cfg.Tiers) { /* reject: tier id out of range */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure client tier ids are within 0..len(tiers)-1 of the volume's tier config","Check `juicefs config` output before using tiered writes","Configure tiers before enabling tiered writeback"],"tags":["azure","blob-storage","tiering","config"],"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"}