{"record":{"id":"bdb4a13262045bcd","repo":"juicedata/juicefs","slug":"ks3-createmultipartupload-returned-empty-uploadid","errorCode":null,"errorMessage":"ks3: CreateMultipartUpload returned empty UploadID for %s","messagePattern":"ks3: CreateMultipartUpload returned empty UploadID for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/ks3.go","lineNumber":271,"sourceCode":"func (s *ks3) ListAll(ctx context.Context, prefix, marker string, followLink bool) (<-chan Object, error) {\n\treturn nil, notSupported\n}\n\nfunc (s *ks3) 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.StorageClass = aws.String(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.ToString(resp.UploadID)\n\tif uploadID == \"\" {\n\t\treturn nil, fmt.Errorf(\"ks3: CreateMultipartUpload returned empty UploadID for %s\", key)\n\t}\n\treturn &MultipartUpload{UploadID: uploadID, MinPartSize: 5 << 20, MaxCount: 10000}, nil\n}\n\nfunc (s *ks3) 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.ToString(resp.ETag)}, nil","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/ks3.go#L253-L289","documentation":"ks3.CreateMultipartUpload issues CreateMultipartUploadWithContext and requires resp.UploadID to be non-empty. KS3 (Kingsoft Cloud Storage) responding without an UploadID is an unexpected response, so the method returns \"ks3: CreateMultipartUpload returned empty UploadID for %s\". The multipart upload cannot continue without the ID, so it fails immediately rather than returning a broken MultipartUpload handle.","triggerScenarios":"CreateMultipartUpload called against a KS3 bucket where the server returns 200 without an UploadID element — non-standard KS3-compatible endpoint, gateway/proxy rewriting the response XML, or server-side error swallowed into an empty field.","commonSituations":"Using a KS3-compatible (not genuine) endpoint; corporate proxy mangling the response body; KS3 service-side incidents; SDK version that mis-parses KS3's response XML field names.","solutions":["Confirm the endpoint is a genuine KS3 endpoint (ks3-cn-*.ksyuncs.com) rather than a proxy or compatible layer.","Retry the operation; if it persists, enable SDK debug logging and inspect the raw CreateMultipartUpload response XML for the UploadID element.","Update the KS3 SDK dependency to the version matching your region's response format.","Contact KS3 support with request ID if the service returns incomplete responses."],"exampleFix":"// before\nendpoint := \"https://s3.compat.internal\"   // compatibility gateway, no UploadID\n// after\nendpoint := \"ks3-cn-beijing.ksyuncs.com\"    // genuine KS3 endpoint","handlingStrategy":"try-catch","validationCode":"if resp.UploadID == nil || aws.ToString(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        return retryOrFallbackUpload(ctx, key)\n    }\n    return err\n}","preventionTips":["Verify the endpoint is a genuine KS3 endpoint for your region.","Keep the KS3 SDK/adapter version current.","Enable SDK wire logging to catch XML shape issues early.","Exercise multipart uploads in integration tests."],"tags":["ks3","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"}