juicedata/juicefs · error

ibmcos: CreateMultipartUpload returned empty UploadId for %s

Error message

ibmcos: CreateMultipartUpload returned empty UploadId for %s

What it means

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.

Source

Thrown at pkg/object/ibmcos.go:261

func (s *ibmcos) ListAll(ctx context.Context, prefix, marker string, followLink bool) (<-chan Object, error) {
	return nil, notSupported
}

func (s *ibmcos) CreateMultipartUpload(ctx context.Context, key string) (*MultipartUpload, error) {
	params := &s3.CreateMultipartUploadInput{
		Bucket: &s.bucket,
		Key:    &key,
	}
	if s.tiers[0].Sc != "" {
		params.SetStorageClass(s.tiers[0].Sc)
	}
	resp, err := s.s3.CreateMultipartUploadWithContext(ctx, params)
	if err != nil {
		return nil, err
	}
	uploadID := aws.StringValue(resp.UploadId)
	if uploadID == "" {
		return nil, fmt.Errorf("ibmcos: CreateMultipartUpload returned empty UploadId for %s", key)
	}
	return &MultipartUpload{UploadID: uploadID, MinPartSize: 5 << 20, MaxCount: 10000}, nil
}

func (s *ibmcos) UploadPart(ctx context.Context, key string, uploadID string, num int, body []byte) (*Part, error) {
	n := int64(num)
	params := &s3.UploadPartInput{
		Bucket:     &s.bucket,
		Key:        &key,
		UploadId:   &uploadID,
		Body:       bytes.NewReader(body),
		PartNumber: &n,
	}
	resp, err := s.s3.UploadPartWithContext(ctx, params)
	if err != nil {
		return nil, err
	}
	return &Part{Num: num, ETag: aws.StringValue(resp.ETag)}, nil

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Verify the endpoint is a genuine IBM COS service endpoint for the bucket's region, not a generic proxy.
  2. Retry the upload; if persistent, capture the raw response (enable SDK debug logging) and check the XML for the UploadId element.
  3. Update the aws-sdk-go / endpoint configuration and confirm bucket/credentials allow multipart uploads.
  4. Contact IBM support with the request ID if the service keeps returning incomplete responses.

Example fix

// before
endpoint := "https://s3.myproxy.internal"   // proxy strips UploadId from response
// after
endpoint := "https://s3.us.cloud-object-storage.appdomain.cloud"  // real COS endpoint
Defensive patterns

Strategy: try-catch

Validate before calling

if resp.UploadId == nil || aws.StringValue(resp.UploadId) == "" {
    return errors.New("provider returned empty UploadId; check endpoint authenticity")
}

Try / catch

mpu, err := storage.CreateMultipartUpload(ctx, key)
if err != nil {
    if strings.Contains(err.Error(), "empty UploadId") {
        // treat as provider malfunction: retry, then fail over to direct upload
        return retryOrDirectUpload(ctx, key)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/a153559aadf44765. Report an issue: GitHub.