{"record":{"id":"10007d17c521e0f6","repo":"juicedata/juicefs","slug":"failed-to-get-s","errorCode":null,"errorMessage":"Failed to get: %s","messagePattern":"Failed to get: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/format.go","lineNumber":358,"sourceCode":"\t\t\tif strings.Contains(err.Error(), \"NoSuchBucket\") {\n\t\t\t\treturn fmt.Errorf(\"Failed to create bucket %s: %s, previous error: %s\\nPlease create bucket %s manually, then format again.\",\n\t\t\t\t\tstore, err2, err, store)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Failed to create bucket %s: %s, previous error: %s\",\n\t\t\t\t\tstore, err2, err)\n\t\t\t}\n\t\t}\n\t\tif err := store.Put(ctx, key, bytes.NewReader(data)); err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to put: %s\", err)\n\t\t}\n\t}\n\t// GLACIER storage class doesn't allow read after write\n\tif _, ok := ctx.Value(object.TierKey{}).(uint8); ok {\n\t\treturn nil\n\t}\n\tp, err := store.Get(ctx, key, 0, -1)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to get: %s\", err)\n\t}\n\tdata2, err := io.ReadAll(p)\n\t_ = p.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !bytes.Equal(data, data2) {\n\t\treturn fmt.Errorf(\"read wrong data: expected %x, got %x\", data, data2)\n\t}\n\terr = store.Delete(ctx, key)\n\tif err != nil {\n\t\t// it's OK to don't have delete permission, but we should warn user explicitly\n\t\tlogger.Warnf(\"Failed to delete, err: %s\", err)\n\t}\n\treturn nil\n}\n\nfunc test(ctx context.Context, store object.ObjectStorage) error {","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/format.go#L340-L376","documentation":"The verification read (Get) of the test object failed after the Put succeeded. JuiceFS writes a test object during format and reads it back to prove the store is usable end-to-end; a failure here means the backend cannot serve reads even though writes appear to work.","triggerScenarios":"`juicefs format` where Put succeeds but Get errors — eventual-consistency lag on some S3-compatible stores, GetObject denied by policy, GLACIER/DEEP_ARCHIVE storage classes requiring restoration (handled separately via TierKey), or KMS key policy denying decrypt.","commonSituations":"Read-only IAM policies that oddly permit Put via a different path; SSE-KMS keys where the principal can encrypt but not decrypt; minio/Swift eventual consistency quirks; storage-class restrictions like Glacier instant retrieval misconfig.","solutions":["Check IAM/bucket policy for s3:GetObject deny on the principal","Verify the storage class isn't archival (Glacier requires restore before read) — or set the appropriate --storage-class/tier","If using SSE-KMS, ensure the key policy permits Decrypt for the principal","Retry format; if transient consistency lag, the second attempt usually passes"],"exampleFix":"// before\n{\"Effect\":\"Allow\",\"Action\":\"s3:PutObject\",\"Resource\":\"arn:aws:s3:::b/*\"}  // no GetObject\n// after\n{\"Effect\":\"Allow\",\"Action\":[\"s3:PutObject\",\"s3:GetObject\"],\"Resource\":\"arn:aws:s3:::b/*\"}","handlingStrategy":"try-catch","validationCode":"// verify read access after writing\n// aws s3api get-object --bucket mybucket --key t /dev/null","typeGuard":null,"tryCatchPattern":"err := doTesting(ctx, store, key, data)\nif err != nil && strings.Contains(err.Error(), \"Failed to get\") {\n    // check GetObject permissions, storage class, KMS decrypt grants\n}","preventionTips":["Grant s3:GetObject alongside s3:PutObject","Avoid archival storage classes (Glacier) for the metadata/test path","With SSE-KMS, allow Decrypt in the key policy","Bypass caches/proxies that may break read-after-write"],"tags":["object-storage","s3","read"],"backgroundTag":"http-error-response","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"}