0026-00000016

更新时间:
复制 MD 格式

Problem description

The position value in the AppendObject request does not match the current length of the object.

Causes

AppendObject requires the position parameter to equal the object's current byte length. If they do not match, OSS rejects the request with this error.

Examples

The following request fails if example.log is not 32 bytes long:

POST /example.log?append&position=32 HTTP/1.1
Content-Length: ContentLength
Content-Type: ContentType
Host: bucketname.oss.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Solutions

Get the correct position value

Send a HeadObject request to get the current length of the object. The x-oss-next-append-position response header gives the value to use as position in the next AppendObject request.

Request:

HEAD /example.log HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 03 Feb 2023 05:57:00 GMT
Authorization: OSS qn6q**************:77Dv****************

Response:

HTTP/1.1 200 OK
Date: Fri, 03 Feb 2023 05:57:16 GMT
Content-Type: application/octet-stream
Content-Length: 4
Connection: keep-alive
x-oss-request-id: 63DCA23C5B537C30327581DB
Accept-Ranges: bytes
ETag: A5750CC1A7FD15****A2DC6300000000
Last-Modified: Fri, 03 Feb 2023 05:57:16 GMT
x-oss-object-type: Appendable
x-oss-hash-crc64ecma: 18020588380933092773
x-oss-next-append-position: 4
x-oss-storage-class: Standard

In this response, x-oss-next-append-position: 4 means the object is 4 bytes long. Use position=4 in the next AppendObject request.

Handle concurrent writes

If multiple clients append to the same object simultaneously, this error can still occur even after reading x-oss-next-append-position. By the time one client sends its request, another client may have already appended data, changing the object length.

Special cases

The request succeeds without error when position=0 and the object does not exist or has zero length. In all other cases where position does not match the object length, this error is returned.

References