Cannot retrieve the next object: iterator has reached the end.

177 views
Skip to first unread message

Alexander

unread,
Feb 24, 2021, 8:33:43 AM2/24/21
to Google Ads Scripts Forum

Following code causes an "iterator has reached the end" error (in one particular account for one particular campaign). It looks like a bug, because bidding.getStrategy() doesn't use iterators.

This problem only occours in 2 accounts - as far as I can tell.

function main(){
  var campaign = AdWordsApp.campaigns().withIds( [ ID_OF_CAMPAIGN ] ).get().next();
  var bidding  = campaign.bidding();
 
  // Cannot retrieve the next object: iterator has reached the end. (file Code.gs, line 7)
  bidding.getStrategy();
}

Sigurd Fabrin

unread,
Feb 25, 2021, 4:21:10 AM2/25/21
to Google Ads Scripts Forum
What campaign types do you have in those two accounts?

Your approach will only work for search and display campaigns 

Alexander

unread,
Feb 25, 2021, 4:43:16 AM2/25/21
to Google Ads Scripts Forum
It is a search campaign. In the Google Ads UI the strategy is shown as "target ROAS". Everything looks normal.

Google Ads Scripts Forum Advisor

unread,
Feb 25, 2021, 9:48:15 PM2/25/21
to adwords...@googlegroups.com

Hi Alexander,

Thanks for raising this to us.

So our team could better check on this, could you share with us your customer ID and the script name?

Regards,

Google Logo
Mark Kevin Albios
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2DIYBf:ref

Alexander

unread,
Feb 26, 2021, 2:53:17 AM2/26/21
to Google Ads Scripts Forum
Don't have permission to "reply to author". Is it ok to share customer ID publicly?
There is only one script in the account and it is called "Iterator_has_reached_the_end"

Google Ads Scripts Forum Advisor

unread,
Feb 28, 2021, 8:09:47 PM2/28/21
to adwords...@googlegroups.com

Hi Alexander,

Thanks for getting back to us.

You can share with us your customer ID and the script name on this forum or if you want, you can also send it to this email (googleadsscr...@google.com). Also, please include the link of this thread so we could keep track of this existing conversation.

Regards,

Google Ads Scripts Forum Advisor

unread,
Mar 1, 2021, 6:36:47 AM3/1/21
to adwords...@googlegroups.com

Hi Alexander,

 

Thanks for providing the requested information. I am Harry, teammate of Mark on the Google Ads Scripts Team. Allow me to assist you this time.

 

A bid strategy report/object cannot be viewed if you do not have access to the account that owns or created the bid strategy. I have run a couple of tests in your account and it would seem that this is the reason why you are encountering the error on your end. In the Google Ads UI - Campaigns Menu, a dialog message will appear stating this information if you hover over the Bid strategy type (Target ROAS) of the campaigns.

 

To explain this simply, you would not be able to access MCC created entities using your child accounts. Kindly try to create an Ads Manager Script instead to retrieve all bidding strategies as it seems that you have created others using your MCC account. Let me know how it goes or if you have questions.

 

Thanks,

Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2DIYBf:ref
Message has been deleted

Google Ads Scripts Forum Advisor

unread,
Mar 2, 2021, 3:55:32 AM3/2/21
to adwords...@googlegroups.com

Hi Alexander,

 

Thanks for the added context. Allow me to reach out to the rest of the team for further analysis and investigation in this regard. Rest assured that I'll be updating you in this thread once I have more information.

Google Ads Scripts Forum Advisor

unread,
Aug 10, 2021, 12:22:38 AM8/10/21
to adwords...@googlegroups.com
Hi Alexander,

Thank you for your patience here. I got an update from the team that the reason behind the error "Iterator has reached the end" you encounter when retrieving Bidding Strategies is that the current account does not have read access to the bidding strategy in question as it was created at the MCC level. What I would recommend is that you work with the owner of the MCC account to avoid the issue and successfully retrieve the bidding strategy.

Let me know if you have other questions/concerns.
Reply all
Reply to author
Forward
0 new messages