Problem description
There are duplicate keys in the request to configure tags for an object or a bucket.
Causes
You initiate a PutObjectTagging request to configure object tagging or a PutBucketTags request to configure bucket tagging, but the XML request body contains duplicate keys.
Examples
For example, you initiate the following request:
PUT /objectname?tagging
Content-Length: xxx
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: Mon, 18 Mar 2019 08:25:17 GMT
Authorization: SignatureValue
<Tagging>
<TagSet>
<Tag>
<Key>A</Key>
<Value>Value</Value>
</Tag>
<Tag>
<Key>A</Key>
<Value>Value</Value>
</Tag>
</TagSet>
</Tagging> In the preceding request, both keys are set to A, which does not meet the requirements. As a result, an error is reported.
Solutions
If you want to include two or more tags in the XML request body, make sure that the keys in the tags are not duplicate. For example, you can set the key of one tag to key1 and the key of the other tag to key2.
PUT /objectname?tagging
Content-Length: 114
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: Mon, 18 Mar 2019 08:25:17 GMT
Authorization: SignatureValue
<Tagging>
<TagSet>
<Tag>
<Key>key1</Key>
<Value>Value1</Value>
</Tag>
<Tag>
<Key>key2</Key>
<Value>Value2</Value>
</Tag>
</TagSet>
</Tagging>