This error occurs when a tagging request contains an invalid tag format. There are two scenarios:
Scenario 1: The
x-oss-taggingrequest header in a PUT object request uses an invalid format.Scenario 2: The
Tag/KeyorTag/Valuenode in a PutBucketTags XML request body fails validation.
Scenario 1: Invalid object tag format
Cause
The x-oss-tagging request header value is not in key or key=value format.
Example
The following request fails because aa=bb=cc contains more than one = sign:
PUT /test.txt HTTP/1.1
Host: test.oss-cn-zhangjiakou.aliyuncs.com
date: Tue, 04 Dec 2018 15:56:37 GMT
authorization: OSS LTAI****************:kZoY************************
x-oss-tagging: aa=bb=ccSolution
Format the x-oss-tagging value as key1=value1&key2=value2. Use = to separate each key-value pair, and & to separate multiple tags.
The following request is valid:
PUT /test.txt HTTP/1.1
Host: test.oss-cn-zhangjiakou.aliyuncs.com
date: Tue, 04 Dec 2018 15:56:37 GMT
authorization: OSS LTAI****************:kZoY************************
x-oss-tagging: aaa=bbb&123=xyzReferences
Scenario 2: Invalid bucket tag format
Cause
A PutBucketTags request contains a Tag/Key or Tag/Value node that does not meet the requirements.
Tag key requirements:
| Requirement | Detail |
|---|---|
| Maximum length | 64 bytes |
| Forbidden prefixes | http://, https://, Aliyun |
| Encoding | UTF-8 |
| Empty value | Not allowed |
Tag value requirements:
| Requirement | Detail |
|---|---|
| Maximum length | 128 bytes |
| Encoding | UTF-8 |
| Empty value | Allowed |
Example
The following request fails because the Tag/Key node value exceeds 64 bytes:
PUT /?tagging
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2018 11:49:13 GMT
Authorization: OSS LTAI****************:kZoY************************
<Tagging>
<TagSet>
<Tag>
<Key>xxx...(200 characters omitted)...xxx</Key>
<Value>test</Value>
</Tag>
</TagSet>
</Tagging>Solution
Make sure the XML request body contains a Tag node that meets the requirements. The following request is valid:
PUT /?tagging
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 20 Dec 2018 11:49:13 GMT
Authorization: OSS LTAI****************:kZoY************************
<Tagging>
<TagSet>
<Tag>
<Key>testa</Key>
<Value>testv1</Value>
</Tag>
<Tag>
<Key>testb</Key>
<Value>testv2</Value>
</Tag>
</TagSet>
</Tagging>