{"record":{"id":"a5f31da4404798ee","repo":"juicedata/juicefs","slug":"failed-to-complete-multipart-upload-v","errorCode":null,"errorMessage":"failed to complete multipart upload: %v","messagePattern":"failed to complete multipart upload: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/objbench.go","lineNumber":1076,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// overwrite the first part\n\t\t\tfirstPartContent := append(seed, seed...)\n\t\t\tif parts[0], err = blob.UploadPart(ctx, key, upload.UploadID, 1, firstPartContent); err != nil {\n\t\t\t\treturn fmt.Errorf(\"multipart upload error: %v\", err)\n\t\t\t}\n\t\t\tcontent[0] = firstPartContent\n\n\t\t\t// overwrite the last part\n\t\t\tlastPartContent := []byte(\"hello\")\n\t\t\tif parts[total-1], err = blob.UploadPart(ctx, key, upload.UploadID, total, lastPartContent); err != nil {\n\t\t\t\treturn fmt.Errorf(\"multipart upload error: %v\", err)\n\t\t\t}\n\t\t\tcontent[total-1] = lastPartContent\n\n\t\t\tif err = blob.CompleteUpload(ctx, key, upload.UploadID, parts); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to complete multipart upload: %v\", err)\n\t\t\t}\n\t\t\tr, err := blob.Get(ctx, key, 0, -1)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to get multipart upload file: %v\", err)\n\t\t\t}\n\t\t\tcnt, err := io.ReadAll(r)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to get multipart upload file: %v\", err)\n\t\t\t}\n\t\t\tif !bytes.Equal(cnt, bytes.Join(content, nil)) {\n\t\t\t\treturn fmt.Errorf(\"the content of the multipart upload file is incorrect\")\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\treturn utils.ErrNotSUP\n\t})\n\n\tfunFSCase(\"change owner/group\", func() error {","sourceCodeStart":1058,"sourceCodeEnd":1094,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/objbench.go#L1058-L1094","documentation":"Returned when blob.CompleteUpload fails after all parts were uploaded in the objbench 'multipart upload' case. CompleteUpload sends the part list (ETags) to finalize the object; failures mean the backend refused to commit — invalid or aborted upload ID, missing/incomplete parts, ETag mismatch, or backend error. The object remains uncommitted (and typically invisible) when this fires.","triggerScenarios":"CompleteUpload called with parts whose ETags/numbers don't match what the backend recorded (e.g. a part overwritten with different content than listed), the upload session was aborted or expired, or the backend returned 4xx/5xx on the complete request.","commonSituations":"S3 'InvalidPart'/'InvalidPartOrder' due to out-of-order part list, another client/abort removed the upload, part size below the store's minimum, or quota/permission errors on finalize.","solutions":["Check the wrapped error for S3 codes like InvalidPart, InvalidPartOrder, NoSuchUpload; fix part ordering (ascending part numbers) before completing.","Verify all parts in the list were uploaded successfully with valid ETags from UploadPart responses.","Re-run with a fresh CreateMultipartUpload session if NoSuchUpload/expiry was reported.","Confirm the credentials can perform CompleteMultipartUpload on the bucket."],"exampleFix":"// before\nif err = blob.CompleteUpload(ctx, key, upload.UploadID, parts); err != nil {\n\treturn fmt.Errorf(\"failed to complete multipart upload: %v\", err)\n}\n// after\nif err = blob.CompleteUpload(ctx, key, upload.UploadID, parts); err != nil {\n\tif errors.Is(err, utils.ErrNotSUP) {\n\t\treturn utils.ErrNotSUP\n\t}\n\treturn fmt.Errorf(\"failed to complete multipart upload (uploadID=%s): %w\", upload.UploadID, err)\n}","handlingStrategy":"try-catch","validationCode":"// before CompleteUpload, verify the part list is complete and ordered\nfor i, p := range parts {\n\tif p == nil || p.ETag == \"\" {\n\t\treturn fmt.Errorf(\"part %d missing ETag\", i+1)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err = blob.CompleteUpload(ctx, key, upload.UploadID, parts); err != nil {\n\tif errors.Is(err, utils.ErrNotSUP) {\n\t\treturn utils.ErrNotSUP\n\t}\n\treturn fmt.Errorf(\"failed to complete multipart upload: %w\", err)\n}","preventionTips":["Keep parts sorted by ascending part number before completing","Use valid ETags returned by UploadPart — never fabricate them","Abort stale sessions before creating new ones to avoid NoSuchUpload","Ensure credentials allow CompleteMultipartUpload"],"tags":["object-storage","multipart-upload","benchmark"],"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"}