Find the original asset when getting error: CANNOT_MODIFY_ASSET_NAME when uploading duplicate image

1,271 views
Skip to first unread message

Антон Бендриков

unread,
May 29, 2021, 4:42:58 PM5/29/21
to AdWords API and Google Ads API Forum
Hello,

when trying to create a new image asset, if the image with the same hash already exists, the following error is returned:

error_code: "CANNOT_MODIFY_ASSET_NAME"
message: "The asset has a name which is different from an existing duplicate that represents the same content".

Is there any way to find out the resource_name of the asset that is already uploaded?
assets.image_data.data is not available to be SELECTed via reporting and querying assets using "WHERE assets.image_data.data = <my_image_hash>" seems to return an empty result.

Is there another way I can find out what is the resource_name of the asset that is already uploaded (and is conflicting with the new upload)?

For reference, example request payload I am using to upload an image asset:
{
  image_asset: {
    data: "<base64_image_hash>",
    mime_type: "IMAGE_PNG"
  },
  name: "Image qPCcjU56Ae",
  type: "IMAGE"
}

Google Ads API Forum Advisor Prod

unread,
May 31, 2021, 4:59:57 AM5/31/21
to antj...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for raising this concern.

If you are looking for a way to get the value of data field, then I am afraid that this is not possible as this field is for mutate only.

However, it appears that the error did not occurred because you've uploaded the same image, rather, this error occurred because you are setting the same asset name. With this, if you are creating new asset, please ensure to use unique name to avoid the error. Furthermore, you can utilize the asset view to know the name of your existing assets before creating new one. 

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Hyur3:ref

Meir Mouyal

unread,
Nov 12, 2021, 5:10:02 AM11/12/21
to AdWords API and Google Ads API Forum
I'm getting the same error and I'm setting a different name, the error message is correct.

How can I know though which is the original asset?

Google Ads API Forum Advisor

unread,
Nov 12, 2021, 10:27:06 AM11/12/21
to meca...@gmail.com, adwor...@googlegroups.com

Hi Meir,

I work with Ernie and will assist you. I reproduced this behavior of CANNOT_MODIFY_ASSET_NAME when uploading duplicate image with a modification in UploadImageAsset.java to upload the image with a name the second time around, the error response didn't show which image was the duplicate. I raised with my team this request for the error message to show which resource name is the duplicate. Upon review we may add this functionality. You may monitor our blog for an update.

In the meantime, you can pull an asset report and filter for dimensions and size and other attributes of the image you are trying to upload and then if there is one match you got the resource name.

SELECT asset.id, asset.image_asset.file_size, asset.image_asset.full_size.height_pixels, asset.image_asset.full_size.url, asset.image_asset.full_size.width_pixels, asset.image_asset.mime_type, asset.name, asset.resource_name FROM asset WHERE asset.image_asset.file_size = 0 AND asset.image_asset.full_size.height_pixels = 0 AND asset.image_asset.full_size.url = '0' AND asset.image_asset.full_size.width_pixels = 0 AND asset.image_asset.mime_type = 'IMAGE_GIF'

Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey

Regards,
 

Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Hyur3:ref

Meir Mouyal

unread,
Nov 12, 2021, 11:10:30 AM11/12/21
to AdWords API and Google Ads API Forum
Hey there,

Yeep... I've thought about filtering through a report but... it's not ideal at all, I might just modify a pixel in the image and upload it.

Typically when getting a duplicate error you really expect to have the Id or some reference that points you to the original resource, so it would be amazing to have that.

I also find really interesting that Assets can't be deleted, why is this?

There is also no UI panel where one can manage all the uploaded assets, right?

Thanks!

Lonny Kapelushnik

unread,
Nov 12, 2021, 12:34:25 PM11/12/21
to AdWords API and Google Ads API Forum
Hi Aryeh,

Wanted to share that I am running into the exact same problem this morning. Looking forward to having this added to the API. I'll check the blog for updates.

Google Ads API Forum Advisor

unread,
Nov 14, 2021, 8:47:29 PM11/14/21
to l...@graydown.com, adwor...@googlegroups.com
Hi everyone,

Thank you for your follow ups. I work with Aryeh and allow me to assist you as well.

@Meir, you may try updating the pixel and let us know how it goes. Also, I've taken note of your suggestion to have the ID or the original resource included in the error for ease of troubleshooting when this error is encountered. As for removing an asset, this is currently not supported. However, a separate feature request was already raised and you may also continue to follow our blog for updates.

As for your UI concern, this is unfortunately outside of our API team's expertise. You may instead reach out to the Google Ads Product Support team, via this link, to clarify available UI features for asset management.

@Lonny, thank you for bumping this thread as well. We have raised your input as well and you may indeed follow our blog for now, for updates.

Best regards,


Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey
 
Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Hyur3:ref

Meir Mouyal

unread,
Nov 17, 2021, 9:09:55 AM11/17/21
to AdWords API and Google Ads API Forum

Hey there,

Is it possible that this has already been solved?

I can't find anything in the blog, however now I seem to get the original asset details as a result!

Thanks :D

Meir Mouyal

unread,
Nov 17, 2021, 9:37:21 AM11/17/21
to AdWords API and Google Ads API Forum
Never mind, it's not fixed yet, the original asset was being returned because I was using the same asset name when creating the asset :/

Google Ads API Forum Advisor

unread,
Nov 17, 2021, 9:35:02 PM11/17/21
to meca...@gmail.com, adwor...@googlegroups.com
Hi Meir,

Thanks for following up.

You may continue to follow our blog for updates. Should you have additional concerns with the API, you may start a new thread and our team would be happy to assist you.

James Grace

unread,
Nov 29, 2021, 12:48:55 AM11/29/21
to AdWords API and Google Ads API Forum
I'm struggling with this same problem.  

The combination of not being able to delete assets and not being able to get the resource_name of the "duplicate" makes this a pretty significant problem in my opinion.  

Is there really no proposed work-around?

James Grace

unread,
Nov 29, 2021, 1:03:51 AM11/29/21
to AdWords API and Google Ads API Forum
Just implemented a hack to modify a random pixel by a single blue (as in RGBA) pixel value (254 vs 255 for example) and it seems to be working.  

Not ideal...but workable.  

Google Ads API Forum Advisor

unread,
Nov 29, 2021, 4:01:19 PM11/29/21
to ja...@aetautomotive.com, adwor...@googlegroups.com
Hi James,

Thank you for reporting on how the hacky workaround works. You may monitor our blog for an update on this popular request.


Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey
 
Regards,
Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Hyur3:ref

Zhe Lin

unread,
Feb 9, 2022, 10:30:57 PM2/9/22
to Google Ads API and AdWords API Forum
Hi there, just wonder if any progress you 've made here for this topic.

It's Feb 2022 and I'm still facing the same error.

As another developer mentioned above

> Typically when getting a duplicate error you really expect to have the Id or some reference that points you to the original resource, so it would be amazing to have that.

That 's really a great thought. So may I have the ID ( or `resource_name` ) in the error message ( so for it is just 'The asset has a name which is different from an existing duplicate that represents the same content' ) ?
Just change the error message. You don't have to take hours to write and publish a blog somewhere.
It would be very very helpful and nobody would reply to this thread and bother you again and again.

Would you consider do that ?

Tim Polt

unread,
Feb 10, 2022, 1:21:04 AM2/10/22
to Google Ads API and AdWords API Forum
After today's update we are getting this error as well and no way to fix it

Error: The asset has a name which is different from an existing duplicate that represents the same content

It stops us from running campaigns would be good to get some clarity around this issue

Thanks

Google Ads API Forum Advisor

unread,
Feb 10, 2022, 2:47:46 AM2/10/22
to timo...@gmail.com, zhe...@leadplus.co.jp, adwor...@googlegroups.com

Hello Everyone,

Thanks for the following up on this thread.

Currently, a feature request has been raised for this; however, please note that there is no guarantee if this will be supported in the API soon. That said, please continue to follow our blog for updates.

Regards,

Google Logo
Mark Kevin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Hyur3:ref

H W

unread,
Feb 10, 2022, 2:50:58 AM2/10/22
to Google Ads API and AdWords API Forum
Hi All,

Same here after the update, I've try to change the name, and try to change few color of some random pixels, but still give me the same error.

Have no ideas what shall do next to solve this

Cheers
Wing

Tim Polt

unread,
Feb 10, 2022, 4:22:54 AM2/10/22
to Google Ads API and AdWords API Forum
Hi Mark,

I understand but this has immediate impact on our ability to run campaigns, we are losing revenue, and can't find work around for this issue.
Main issue is that we have uploaded a lot of images and now we can't even tell which are in conflict, and that makes it a big issue.
So any work around in meantime would be much welcomed.

Thanks

Matteo Medda

unread,
Feb 10, 2022, 7:10:37 AM2/10/22
to Google Ads API and AdWords API Forum

Hello, we have the same problem starting this morning. We have not changed anything on our code. What is the correct procedure for uploading an asset? We have all campaigns stopped for this reason.

Thanks

Edgar Khachatryan

unread,
Feb 10, 2022, 9:34:07 AM2/10/22
to Google Ads API and AdWords API Forum

Hi everyone. I have some strange and quick solution for this problem. I CROP(cut) every uploaded image with some random width and height. And only after that i upload that CROPED image as asset, and that image seems like new unique image.
Ex. in PYTHON

# For 1.91:1 ratio
ratio = 191/100

# Width and height of image to crop
width = random.randint(600, 1024)
height = round(width / ratio)

# Width and height for square images
squareDim = random.randint(300, height)

After crop the image I was create asset with that image and set name of Asset some unqiue name str(uuid.uuid4()).

Thanks!

Google Ads API Forum Advisor

unread,
Feb 10, 2022, 2:21:37 PM2/10/22
to ed...@gsmediagroup.net, adwor...@googlegroups.com
Hi everyone,

Let me bring this up with my team. We will get back to you as soon as possible.

Regards,

Google Logo
Aryeh
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Hyur3:ref

Tim Polt

unread,
Feb 10, 2022, 6:56:45 PM2/10/22
to Google Ads API and AdWords API Forum
Yeah modifying image by changing pixel color or cropping kinda works as ugly hack but google should fix this.
No way this is acceptable, what's worst we have more than 100K assets and we dont know which asset is what,
so ability to find an asset and replace it, makes sense however current release does not address this issue.

Thanks
Tim

MAPI Test

unread,
Feb 11, 2022, 6:27:39 AM2/11/22
to Google Ads API and AdWords API Forum
Hi all, 

we have this issue as well since 2 days.
We're using SDK v.16.0.2 which uses API v.9
It stops us from uploading any image which has ever been uploaded to our accounts before because of the clashing asset names.
It would be great if you could take care. 

Thanks and best regards

Luciano Santana

unread,
Feb 11, 2022, 12:40:53 PM2/11/22
to Google Ads API and AdWords API Forum
Hi everyone,

In our case, we actually get an asset ID on the error message, as you can see below. I've redacted the original values with xxxxxxxx to prevent sharing sensitive information.

[AssetError{super=AssetError.CANNOT_MODIFY_ASSET_NAME @ operations[0].operand.assetName; trigger:'There is an existing asset that represents the same content as the asset to be added, but with a different name: the input asset has name 'xxxxxxxx'; and the existing asset has name '
xxxxxxxx' and ID xxxxxxxx. Remove the existing asset first if you would like to change the name of the asset.', reason=CANNOT_MODIFY_ASSET_NAME}]

Our solution was to parse the error message string in order to capture the existing asset ID and use that ID to post the ads. It is not ideal, because if tomorrow they change the error message it will make our parser useless. But it is an acceptable workaround until someone from Google provides a proper alternative. This is also more viable than "manually" generating changes on the assets, like cropping, as suggested earlier.

I hope that is helpful. 

Question to Google Ads team, is it intentional to delegate this handling to the client? In case yes, I propose at least to provide the existing Asset data in a more structured way, together with the Error object. Alternatively, why not simple returning the existing Asset instead of throwing an error on our way? 

Google Ads API Forum Advisor

unread,
Feb 11, 2022, 5:32:50 PM2/11/22
to luc...@mobilejazz.com, adwor...@googlegroups.com

Hi Luciano,

Right now, parsing the error message is the way to handle this error. I'll work with the team to try and introduce a better way to expose this error.
 

Cheers
Anash



ref:_00D1U1174p._5004Q2Hyur3:ref
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Meir Mouyal

unread,
Feb 15, 2022, 12:06:03 PM2/15/22
to Google Ads API and AdWords API Forum
Lately I have been getting this error too.

I used to get it in the past by passing an asset name when creating the asset, but then I realized that the asset name was optional, so not passing the asset name solved the issue. However now I'm getting the issue again even though I'm not passing any asset name.

gean pearre Silva

unread,
Feb 15, 2022, 7:29:44 PM2/15/22
to Google Ads API and AdWords API Forum

My fastest solution was the following:
$error_message = str_replace(". Remove the existing asset first if you would like to change the name of the asset., reason=CANNOT_MODIFY_ASSET_NAME}]","",str_replace("'", "", $e->getMessage()));

$arr = explode(" ", $ error_message);
$size = sizeof($arr);
$asset_Id = trim($arr[$size -1]);

Once the asset_id is obtained, this is the same one that I send together with the creation of the campaign

I am using the PHP SDK

MAPI Test

unread,
Feb 17, 2022, 8:55:55 AM2/17/22
to Google Ads API and AdWords API Forum
Hi all,

Fortunately, we were able to resolve the issue by using the latest Java SDK version (17.0.0) which uses the new API version 10. 

When doing the calls to this API, we don’t receive the error anymore and instead, the existing asset id is automatically reused when we upload the same image again.


Google Ads API Forum Advisor

unread,
Feb 17, 2022, 4:46:28 PM2/17/22
to google....@innogames.com, adwor...@googlegroups.com
Hi,

Google Ads API v10 deduplicates the images and no longer throws this error, so if you can upgrade to this version, then this error should go away. All the client libraries are expected to be available by this Friday.
Message has been deleted

Michael Kopylenko

unread,
Feb 25, 2022, 1:54:05 AM2/25/22
to Google Ads API and AdWords API Forum
Hi,

I faced the same issue and it was resolved after I installed API v10. Images having a name can be recognized when uploaded to account and the same image is exist in this account. But I think there is still an issue with unnamed images. If an image existing in account has no name and same image is uploaded, it's not recognized and the error: "NAME_REQUIRED_FOR_ASSET_TYPEis thrown. Tried to pass empty name but it doesn't help. Please advise...

Google Ads API Forum Advisor

unread,
Feb 28, 2022, 5:01:11 PM2/28/22
to mkopy...@gmail.com, adwor...@googlegroups.com
Hi Michael,

Could you privately send us a request and response log of API communication that returns this error in v10?  The request and response appears similar to the JSON Mappings in our REST documentation. Our client libraries have loggers with logging instructions, to see these instructions you can click on the client library you use in the sidebar of our client library guide and click on "Logging". Setting the logger to 'DEBUG' will get the desired log.

Regards,

Google Logo
Aryeh
Google Ads API Team
 



 

ref:_00D1U1174p._5004Q2Hyur3:ref

Michael Kopylenko

unread,
Mar 3, 2022, 3:00:02 AM3/3/22
to Google Ads API and AdWords API Forum
Hi Arieh,

Not sure why you need logs from our side as this issue can be easily reproduced: if you have existing UNNAMED image asset in an account, the same image cannot be uploaded to this account. The error “NAME_REQUIRED_FOR_ASSET_TYPE” will be raised by API. 
As for logs, we have a problem with enabling logging currently. Taking it with php client team, but without a result meanwhile.

Google Ads API Forum Advisor

unread,
Mar 3, 2022, 9:07:06 PM3/3/22
to mkopy...@gmail.com, adwor...@googlegroups.com
Hi Michael,

I have responded to your inquiry on the private email you sent over to our team.

We can utilize that thread instead to continue our discussions on the error that you are encountering.

Best regards,

Google Logo
Peter Laurence
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Hyur3:ref
Reply all
Reply to author
Forward
0 new messages