Problem description
In a client-side encryption multipart upload, the number of parts in the CompleteMultipartUpload request exceeds the expected part count that OSS calculates from the InitiateMultipartUpload request.
Causes
When you call InitiateMultipartUpload with client-side encryption, OSS reads two headers to determine the expected part count:
x-oss-meta-client-side-encryption-data-size: the total size of the data to uploadx-oss-meta-client-side-encryption-part-size: the size of each part
OSS calculates the expected part count based on the data size and part size specified in these headers. If the number of parts in CompleteMultipartUpload exceeds this value, OSS returns the error.
Examples
The following InitiateMultipartUpload request sets a data size of 1,000,000 bytes and a part size of 500,000 bytes. OSS expects 2 parts.
POST /multipart.data?uploads HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Wed, 22 Feb 2012 08:32:21 GMT
x-oss-storage-class: Archive
Authorization: OSS qn6q**************:77Dv****************
x-oss-meta-client-side-encryption-data-size: 1000000
x-oss-meta-client-side-encryption-part-size: 500000The following CompleteMultipartUpload request specifies 3 parts (part numbers 1, 5, and 8), which exceeds the expected count of 2. OSS returns the error.
POST /multipart.data?uploadId=0004B9B2D2F7815C432C9057C031****&encoding-type=url HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Content-Length: 1056
Date: Fri, 24 Feb 2012 10:19:18 GMT
Authorization: OSS qn6q**************:77Dv****************
<CompleteMultipartUpload>
<Part>
<PartNumber>1</PartNumber>
<ETag>"3349DC700140D7F86A0784842780****"</ETag>
</Part>
<Part>
<PartNumber>5</PartNumber>
<ETag>"8EFDA8BE206636A695359836FE0A****"</ETag>
</Part>
<Part>
<PartNumber>8</PartNumber>
<ETag>"8C315065167132444177411FDA14****"</ETag>
</Part>
</CompleteMultipartUpload>Solutions
Fix the mismatch using one of the following approaches:
Reduce the part count: Make sure the number of parts in CompleteMultipartUpload does not exceed the expected part count from your InitiateMultipartUpload request.
Adjust the data size or part size: Change
x-oss-meta-client-side-encryption-data-sizeorx-oss-meta-client-side-encryption-part-sizein InitiateMultipartUpload so that the expected part count accommodates the actual number of parts you intend to upload.