0026-00000201
Problem description
The object that you specify already exists.
Causes
You initiated a request, such as PutObject or CopyObject, to write data to an object. However, the name of the object into which you want to write data already exists. As a result, the error is returned.
Examples
For example, you initiate the following request:
PUT /object-exist.txt HTTP/1.1
Content-Length: ContentLength
Content-Type: ContentType
Host: examplebucket.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
x-oss-forbid-overwrite: true
In the preceding request, thex-oss-forbid-overwrite parameter specifies whether to overwrite the object that has the same name. If this parameter is set to true, the object that has the same name is not overwritten. In this case, if an object named object-exist.txt already exists in the examplebucket bucket, the error is returned.
Solutions
-
If you want to check whether an object with the specified name exists, call the HeadObject operation. If the HTTP status code 404 is returned, no object with the specified name exists.
-
If you want to overwrite the object with the same name, remove
x-oss-forbid-overwritefrom your request or set x-oss-forbid-overwrite to false. -
If you want to retain both the new object and the existing object with the same name, we recommend that you enable the versioning feature for the bucket. For more information, see Enable versioning.