{"record":{"id":"a153559aadf44765","repo":"juicedata/juicefs","slug":"ibmcos-createmultipartupload-returned-empty-uploa","errorCode":null,"errorMessage":"ibmcos: CreateMultipartUpload returned empty UploadId for %s","messagePattern":"ibmcos: CreateMultipartUpload returned empty UploadId for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/ibmcos.go","lineNumber":261,"sourceCode":"func (s *ibmcos) ListAll(ctx context.Context, prefix, marker string, followLink bool) (<-chan Object, error) {\n\treturn nil, notSupported\n}\n\nfunc (s *ibmcos) CreateMultipartUpload(ctx context.Context, key string) (*MultipartUpload, error) {\n\tparams := &s3.CreateMultipartUploadInput{\n\t\tBucket: &s.bucket,\n\t\tKey:    &key,\n\t}\n\tif s.tiers[0].Sc != \"\" {\n\t\tparams.SetStorageClass(s.tiers[0].Sc)\n\t}\n\tresp, err := s.s3.CreateMultipartUploadWithContext(ctx, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tuploadID := aws.StringValue(resp.UploadId)\n\tif uploadID == \"\" {\n\t\treturn nil, fmt.Errorf(\"ibmcos: CreateMultipartUpload returned empty UploadId for %s\", key)\n\t}\n\treturn &MultipartUpload{UploadID: uploadID, MinPartSize: 5 << 20, MaxCount: 10000}, nil\n}\n\nfunc (s *ibmcos) UploadPart(ctx context.Context, key string, uploadID string, num int, body []byte) (*Part, error) {\n\tn := int64(num)\n\tparams := &s3.UploadPartInput{\n\t\tBucket:     &s.bucket,\n\t\tKey:        &key,\n\t\tUploadId:   &uploadID,\n\t\tBody:       bytes.NewReader(body),\n\t\tPartNumber: &n,\n\t}\n\tresp, err := s.s3.UploadPartWithContext(ctx, params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Part{Num: num, ETag: aws.StringValue(resp.ETag)}, nil","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/ibmcos.go#L243-L279","documentation":"ibmcos.CreateMultipartUpload issues a CreateMultipartUploadWithContext call and, despite a successful response, guards against an empty UploadId. IBM COS returning 200 with no UploadId is an unexpected API response, so the method fails with \"ibmcos: CreateMultipartUpload returned empty UploadId for %s\". Without an UploadId no part uploads can proceed, so the error is raised eagerly.","triggerScenarios":"CreateMultipartUpload called on an IBM COS bucket where the service responds 200 but omits resp.UploadId — typically a proxy/gateway stripping fields, an incompatible S3 endpoint, or a malformed server response.","commonSituations":"Pointing the ibmcos endpoint at a non-COS S3-compatible proxy that doesn't implement multipart correctly; IBM COS outage returning incomplete responses; response deserialization dropping the UploadId due to XML shape mismatch.","solutions":["Verify the endpoint is a genuine IBM COS service endpoint for the bucket's region, not a generic proxy.","Retry the upload; if persistent, capture the raw response (enable SDK debug logging) and check the XML for the UploadId element.","Update the aws-sdk-go / endpoint configuration and confirm bucket/credentials allow multipart uploads.","Contact IBM support with the request ID if the service keeps returning incomplete responses."],"exampleFix":"// before\nendpoint := \"https://s3.myproxy.internal\"   // proxy strips UploadId from response\n// after\nendpoint := \"https://s3.us.cloud-object-storage.appdomain.cloud\"  // real COS endpoint","handlingStrategy":"try-catch","validationCode":"if resp.UploadId == nil || aws.StringValue(resp.UploadId) == \"\" {\n    return errors.New(\"provider returned empty UploadId; check endpoint authenticity\")\n}","typeGuard":null,"tryCatchPattern":"mpu, err := storage.CreateMultipartUpload(ctx, key)\nif err != nil {\n    if strings.Contains(err.Error(), \"empty UploadId\") {\n        // treat as provider malfunction: retry, then fail over to direct upload\n        return retryOrDirectUpload(ctx, key)\n    }\n    return err\n}","preventionTips":["Use official vendor endpoints, not generic S3 proxies.","Pin and update SDK versions matching the provider.","Log raw responses when debugging multipart flows.","Test multipart uploads (object >= 5MiB) against the endpoint in CI."],"tags":["ibmcos","multipart-upload","s3","object-storage"],"backgroundTag":"unexpected-api-response-shape","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"}