juicedata/juicefs · error

ks3: CreateMultipartUpload returned empty UploadID for %s

Error message

ks3: CreateMultipartUpload returned empty UploadID for %s

What it means

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.

Source

Thrown at pkg/object/ks3.go:271

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

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

func (s *ks3) 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.ToString(resp.ETag)}, nil

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Confirm the endpoint is a genuine KS3 endpoint (ks3-cn-*.ksyuncs.com) rather than a proxy or compatible layer.
  2. Retry the operation; if it persists, enable SDK debug logging and inspect the raw CreateMultipartUpload response XML for the UploadID element.
  3. Update the KS3 SDK dependency to the version matching your region's response format.
  4. Contact KS3 support with request ID if the service returns incomplete responses.

Example fix

// before
endpoint := "https://s3.compat.internal"   // compatibility gateway, no UploadID
// after
endpoint := "ks3-cn-beijing.ksyuncs.com"    // genuine KS3 endpoint
Defensive patterns

Strategy: try-catch

Validate before calling

if resp.UploadID == nil || aws.ToString(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") {
        return retryOrFallbackUpload(ctx, key)
    }
    return err
}

Prevention

When it happens

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

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

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/bdb4a13262045bcd. Report an issue: GitHub.