Error during product partition creation

671 views
Skip to first unread message

pushpendra jaiswal

unread,
Oct 5, 2015, 11:52:03 AM10/5/15
to AdWords API Forum
During product partition in a newly created adgroup, getting error(some times the code works and other time it gives an error)

Server raised fault: '[AdGroupCriterionError.PRODUCT_PARTITION_ALREADY_EXISTS @ operations[0].operand.criterion, AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[1].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}', AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[2].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}']'

I'm using adwordsapi python

https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201502/shopping/add_product_partition_tree.py

helper = ProductPartitionHelper(adgroup_id)
root = helper.CreateSubdivision()
cool_product_brand = {'xsi_type': 'ProductCustomAttribute','type': row['Target'],'value': row['Target Data']}
other_product_brand = {'xsi_type': 'ProductCustomAttribute','type': row['Target'],}
helper.CreateUnit(root, cool_product_brand, int(float(row['Bid'])*1000000))
helper.CreateUnit(root, other_product_brand)
adgroup_criterion_service.mutate(helper.GetOperations())

Anthony Madrigal

unread,
Oct 5, 2015, 3:09:55 PM10/5/15
to AdWords API Forum
Hi,

You said that sometimes this code works for you. In what instances does it work? Could you also provide me through Reply privately to author your SOAP request and response where you are getting these errors?

Thanks,
Anthony
AdWords API Team

pushpendra jaiswal

unread,
Oct 6, 2015, 4:20:21 AM10/6/15
to AdWords API Forum
Thanks for your response .

If my account don't have any active/paused campaign, in the case the code works and if account already have a active/paused campaign then doesn't work .

Anthony Madrigal

unread,
Oct 6, 2015, 10:06:53 AM10/6/15
to AdWords API Forum
Hi, 

Since you are using the AdGroupCriterionService, do you mean AdGroup instead of campaign? Could you please send me both your SOAP request and response for the successful and failed operations through Reply privately to author? This will help me see why it is working for one and not the other.

peter.r...@smarter-ecommerce.com

unread,
Oct 30, 2015, 6:35:58 AM10/30/15
to AdWords API Forum
It looks like that we have the same problem. 

We create a brand new AdGroup, then send the following request:

    <soapenv:Body>
            <operations>
               <operator>ADD</operator>
            <operand xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201506" xsi:type="ns2:BiddableAdGroupCriterion">
                   <ns2:adGroupId>22340202143</ns2:adGroupId>
                   <ns2:criterion xsi:type="ns2:ProductPartition">
                       <ns2:id>-1</ns2:id>
                       <ns2:partitionType>SUBDIVISION</ns2:partitionType>
                   </ns2:criterion>
                 </operand>
            </operations>
            <operations>
               <operator>ADD</operator>
            <operand xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201506" xsi:type="ns3:NegativeAdGroupCriterion">
                   <ns3:adGroupId>22340202143</ns3:adGroupId>
                   <ns3:criterion xsi:type="ns3:ProductPartition">
                       <ns3:partitionType>UNIT</ns3:partitionType>
                       <ns3:parentCriterionId>-1</ns3:parentCriterionId>
                       <ns3:caseValue xsi:type="ns3:ProductOfferId"/>
                   </ns3:criterion>
                </operand>
            </operations>
            <operations>
               <operator>ADD</operator>
                <operand xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201506" xsi:type="ns4:BiddableAdGroupCriterion">
                   <ns4:adGroupId>22340202263</ns4:adGroupId>
                   <ns4:criterion xsi:type="ns4:ProductPartition">
                       <ns4:id>-1</ns4:id>
                       <ns4:partitionType>SUBDIVISION</ns4:partitionType>
                   </ns4:criterion>
                </operand>
            </operations>
            <operations>
               <operator>ADD</operator>
                <operand xmlns:ns5="https://adwords.google.com/api/adwords/cm/v201506" xsi:type="ns5:NegativeAdGroupCriterion">
                   <ns5:adGroupId>22340202263</ns5:adGroupId>
                   <ns5:criterion xsi:type="ns5:ProductPartition">
                       <ns5:partitionType>UNIT</ns5:partitionType>
                       <ns5:parentCriterionId>-1</ns5:parentCriterionId>
                       <ns5:caseValue xsi:type="ns5:ProductOfferId"/>
                   </ns5:criterion>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>

and sporadically get back

<soap:Body>
    <soap:Fault>
       <faultcode>soap:Server</faultcode>
            <faultstring>[AdGroupCriterionError.PRODUCT_PARTITION_ALREADY_EXISTS @ operations[2].operand.criterion, AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[3].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}']</faultstring>
        <detail>
           <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201506">
                    <message>[AdGroupCriterionError.PRODUCT_PARTITION_ALREADY_EXISTS @ operations[2].operand.criterion, AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ operations[3].operand.criterion.parentCriterionId; trigger:'TempCriterionId{id=1}']</message>
               <ApplicationException.Type>ApiException</ApplicationException.Type>
               <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AdGroupCriterionError">
                   <fieldPath>operations[2].operand.criterion</fieldPath>
                   <trigger/>
                   <errorString>AdGroupCriterionError.PRODUCT_PARTITION_ALREADY_EXISTS</errorString>
                   <ApiError.Type>AdGroupCriterionError</ApiError.Type>
                   <reason>PRODUCT_PARTITION_ALREADY_EXISTS</reason>
                </errors>
               <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AdGroupCriterionError">
                   <fieldPath>operations[3].operand.criterion.parentCriterionId</fieldPath>
                   <trigger>TempCriterionId{id=1}</trigger>
                   <errorString>AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST</errorString>
                   <ApiError.Type>AdGroupCriterionError</ApiError.Type>
                   <reason>PRODUCT_PARTITION_DOES_NOT_EXIST</reason>
                </errors>
           </ApiExceptionFault>
        </detail>
    </soap:Fault>
</soap:Body>

(request id of this particular response was 00052343fe9006900a0ddbd10203b361 - if this helps).

We also see this error when creating concrete product partitions with case values. It succeeds in 99% of all cases, but we sporadically get back this error. We've seen this only for product partitions so far. Our code is single-threaded.

Josh Radcliff (AdWords API Team)

unread,
Oct 30, 2015, 3:43:58 PM10/30/15
to AdWords API Forum
Hi,

I noticed that your request is operating on two ad groups but you are reusing the same temporary ID for both. I would recommend using distinct temporary IDs for distinct Biddable/NegativeAdGroupCriterion within a single request.

Also, in each case you are constructing what looks like an invalid product partition tree, consisting of:

     ROOT (-1 biddable SUBDIVISION)
    /
  ProductOfferId (negative UNIT)

It looks like you are trying to create a 2nd level of the tree that excludes everything, since you don't have other UNIT nodes at that level and the object is a NegativeAdGroupCriterion. If you subdivide the tree by a dimension (offer ID in this case), you must have at least two UNIT nodes: one for "Everything else" (ProductOfferId with a null value) and at least one for a specific ProductOfferId with a non-null value. Otherwise, the subdivision does not serve any purpose.

Thanks,
Josh, AdWords API Team

peter.r...@smarter-ecommerce.com

unread,
Nov 2, 2015, 12:30:38 AM11/2/15
to AdWords API Forum
Hi Josh

Could the usage of not using distinct temporary IDs cause this problem ? As stated above, 99% of my requests succeed (and we've actually sent millions of them until now). 

The tree is correct for our purposes. It will be changed by other requests later on. The problem doesn't seem to be related to the actual tree anyhow. We also see this error when we are trying to add child partitions to already existing ones. This, however, is very hard to reproduce for me since I cannot just add logs for every SOAP request to our live application and wait for a few days for this to happen. Even this simple case required hammering against the API with a local test script for a few hours. 

Thanks! 
Peter

Josh Radcliff (AdWords API Team)

unread,
Nov 2, 2015, 1:56:56 PM11/2/15
to AdWords API Forum
Hi Peter,

Are you running multiple threads that are mutating the trees in question? I ask because I looked at two of your requests from today that failed with PRODUCT_PARTITION_ALREADY_EXISTS followed by PRODUCT_PARTITION_DOES_NOT_EXIST, and in both cases the partition in question does already exist in the ad group.

The requests I checked were for ad group IDs 21637072081 and 21637229281, both under campaign ID 345581401.

Thanks,
Josh, AdWords API Team

peter.r...@smarter-ecommerce.com

unread,
Nov 3, 2015, 8:11:43 AM11/3/15
to AdWords API Forum

i Josh 


Our app definitely mutates trees in parallel - but it never mutates trees in parallel belonging to the same campaigns. The requests that I sent before were reproduced in a single-threaded sandbox. The requests you mention are requests that our app tries to send once a day exactly because of this issue (it’s a follow up error on our side). The first occurrence (the one that should be this issue) must have been somewhere around 2015-10-30 16:35:32 (+/- a few minutes) - maybe this helps. We currently resolve this on our side by reacting to the error - we will just query the external id of the existing partition. This is released on our system tomorrow - so it will definitely get harder for me to find the underlying requests since no special logging is done on our side due to the fact that this case gets business as usual … sorry.


Here is some additional info from our side: We've got other code that creates many product partitions - and we’ve never seen this before. The difference is that this code (the one working w/o any problems) never creates product partitions for more than one ad group at a time. The code where the issues arises sends stuff in batches to the API and mutates a maximum of 2 ad groups at a time (since this is the maximum allowed by the API).


Thanks!

Peter

peter.r...@smarter-ecommerce.com

unread,
Nov 3, 2015, 8:41:56 AM11/3/15
to AdWords API Forum
Hi Josh 

These are really wild assumptions, but for me it looks like that I can see the same problem with other requests regarding shopping ad group criterions too. 

I've got another case that looks pretty similar to me (though I cannot prove this since I do not have SOAP logs for this). But from our logs I can see that we've sent a deletion request for shopping ad group criterions (e.g.: item id = 333518-105, criterion id = 139771732115, ad group id = 23172885875, campaign id = 321117275). The product partition was successfully deleted - I can see this in the change logs in the Adwords UI (30.10.2015 06:06:07). But my application logs tell me that the API returned an error
Errors while removing group item bids: Group 23172885875: Item 333518-105: [EntityNotFound,CriterionId{id=139771732115},EntityNotFound.INVALID_ID;];

For me it looks like that someone duplicates the same request. I've double checked our logs and they tell me that it's not our application (as stated above I unfortunately cannot see the SOAP request directly). 
When looking at the SOAP logs that I've provided earlier I assume the same could have happened here.

Josh Radcliff (AdWords API Team)

unread,
Nov 3, 2015, 11:42:00 AM11/3/15
to AdWords API Forum
Hi,

I took a look at the requests coming from your developer token, and I see REMOVE mutate requests coming in for that ad group's criteria at the following times:

ViennaTime : 2015-10-30 06:05:40
Successful : True

ViennaTime : 2015-10-30 06:06:04
Successful : False

In the user interface, I see the product groups were removed via the API at 2015-10-30 06:06:07. I realize that is after the 2nd request, but I'm theorizing that the first request may have taken 27 seconds to complete. Do you happen to have timestamps in your logs for those requests?

Thanks,
Josh, AdWords API Team

peter.r...@smarter-ecommerce.com

unread,
Nov 10, 2015, 10:09:09 AM11/10/15
to AdWords API Forum
Hi 

No, I can't see any logs in our system despite the fact that the request has failed - but those logs were logged a few minutes later because further request were logged aggregated by our application. 

The first example (PRODUCT_PARTITION_ALREADY_EXISTS from 30.10.2015) that I've posted to this thread happened on 

29.10.2015 21:17:20,497

requestId (taken from response) = 00052343fe9006900a0ddbd10203b361


I can definitely see from the SOAP logs (from the Adwords API) that a new group was created and the product partition add request was only sent once. Does this help ?

Josh Radcliff (AdWords API Team)

unread,
Nov 11, 2015, 2:55:04 PM11/11/15
to AdWords API Forum
Hi Peter,

Using that request ID, I found some information on our side that indicates that there may have been an unexpected duplication of this request. I'm following up with the service owners to see what happened here, and will let you know as soon as I hear back from them.

Thanks,
Josh, AdWords API Team

peter.r...@smarter-ecommerce.com

unread,
Nov 17, 2015, 11:25:13 PM11/17/15
to AdWords API Forum
Hi Josh

Any updates on this ?

Thanks!
Peter

Josh Radcliff (AdWords API Team)

unread,
Nov 18, 2015, 10:11:08 AM11/18/15
to AdWords API Forum
Hi Peter,

No updates yet, but the engineers are looking into it. I'll get back to you as soon as I hear anything.

Cheers,
Josh, AdWords API Team

peter.r...@smarter-ecommerce.com

unread,
Dec 9, 2015, 5:00:49 AM12/9/15
to AdWords API Forum

Sorry for bothering again - still no updates on this ?

Thanks! 
Peter

Josh Radcliff (AdWords API Team)

unread,
Dec 9, 2015, 4:51:15 PM12/9/15
to AdWords API Forum
Hi Peter,

I still don't have an update, unfortunately. I've reached out to the engineers again and will let you know when I get a response.

Thanks,
Josh, AdWords API Team

Josh Radcliff (AdWords API Team)

unread,
Mar 21, 2016, 8:29:45 AM3/21/16
to AdWords API Forum
Hi Peter,

Are you still experiencing this issue, and if so, how frequently?

As suspected, this was due to retries within our services, but unfortunately I don't have a great solution on how to detect this particular scenario, so I'm curious to know if this is still having a large impact for you.

Thanks,
Josh, AdWords API Team


On Wednesday, December 9, 2015 at 4:51:15 PM UTC-5, Josh Radcliff (AdWords API Team) wrote:
Hi Peter,

I still don't have an update, unfortunately. I've reached out to the engineers again and will let you know when I get a response.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages