Persistent QueryError.UNEXPECTED_INPUT with DURING Clause in Any GAQL Query

20 views
Skip to first unread message

北島優人

unread,
Aug 26, 2025, 4:52:24 AM (11 days ago) Aug 26
to Google Ads Scripts Forum

Hello

I'm facing a persistent and strange issue with Google Ads Scripts and hope someone here can shed some light on it. I am unable to run any GAQL query that contains a DURING clause. Every attempt fails with the same error:

UserError: QueryError.UNEXPECTED_INPUT: Error in query: unexpected input DURING.

I have gone through extensive troubleshooting and have ruled out any syntax errors in my script. I am now convinced the issue is specific to my account's execution environment.

Here are the steps I've taken to debug this:

Troubleshooting Steps

  1. Initial Script: The problem first appeared in a script designed to pull video asset performance data. The query was complex and included several WHERE conditions.

  2. Simplified Query: To isolate the cause, I removed all user-defined filters from the query (like campaign.name). The error persisted.

  3. Removed Variables: I suspected an issue with how the date range variable was being passed. I removed the variable and hardcoded the date range directly into the query string (e.g., DURING LAST_30_DAYS). This also failed with the exact same error.

  4. Minimal Diagnostic Test: Finally, to prove the issue was not with my script, I created a brand new, empty script and ran the simplest possible GAQL query that uses a DURING clause.

Diagnostic Script Code:

JavaScript
function main() { try { // The most basic query possible with a date range const query = "SELECT campaign.name FROM campaign DURING YESTERDAY LIMIT 1"; Logger.log("Executing query:"); Logger.log(query); const report = AdsApp.search(query); Logger.log("Test succeeded."); } catch (e) { Logger.log("Test failed. See error below:"); Logger.log(e); } }

Result of Diagnostic Test:

This minimal script also failed, producing the exact same error. Here is the log output:

Executing query: SELECT campaign.name FROM campaign DURING YESTERDAY LIMIT 1 Test failed. See error below: UserError: QueryError.UNEXPECTED_INPUT: Error in query: unexpected input DURING.

Conclusion

Since even the most basic, syntactically correct GAQL query fails, I am certain that this is not a scripting error on my part. The issue seems to be a fundamental problem within my account's script execution environment that prevents it from correctly parsing the DURING clause.

Has anyone in the community ever experienced something like this? Is there any other debugging step I might have missed, or does this require direct intervention from the Google Ads technical support team?

Any help or insight would be greatly appreciated.

Thanks for your time.

Joseph Dobbs

unread,
Aug 26, 2025, 5:08:05 AM (11 days ago) Aug 26
to 北島優人 提供者 Google Ads Scripts Forum
Hello,

Please message google support as your queries are coming through to me.

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scrip...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/adwords-scripts/0804cf4b-0336-47c8-a7ca-fab99339c73bn%40googlegroups.com.
Message has been deleted

Google Ads Scripts Forum Advisor

unread,
Aug 26, 2025, 6:30:59 AM (11 days ago) Aug 26
to adwords...@googlegroups.com

Hi,

Thank you for reaching out to the Google Ads Scripts support team.

I could see that the GAQL query you have provided is invalid. Please be noted that while using the date filter you should use the “WHERE” clause in the query. You may refer to the below sample query to retrieve the first campaign and to remove all campaigns, you can remove the “LIMIT”.

SELECT campaign.name FROM campaign WHERE segments.date DURING YESTERDAY LIMIT 1

Additionally, you can utilize the Google Ads Query Builder and Query Validator to build and validate the queries for retrieving the data from the Google Ads API.

I hope this helps! Feel free to get back to with the following details if you still face any issues.

  • Google Ads account ID/CID
  • Name of the affected script
  • Shareable spreadsheet link if you are using any in the script. You may follow this guide to share a file publicly
You can share the requested details via Reply privately to the author option or a direct private reply to this email.

Thanks,
 
Google Logo Google Ads Scripts Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-08-26 10:30:25Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u5AKy:ref" (ADR-00331004)



北島優人

unread,
Aug 28, 2025, 3:18:12 AM (9 days ago) Aug 28
to Google Ads Scripts Forum on behalf of adsscripts

Hi,

Thank you for your prompt and helpful reply. The sample query you provided resolved the issue immediately. The script is now working as expected.

Also, the links to the Query Builder and Validator are very helpful. I'll be sure to use them in the future.

Thanks again for your great support.

Sincerely,

Yuto


2025年8月26日(火) 19:31 Google Ads Scripts Forum on behalf of adsscripts <adwords...@googlegroups.com>:
--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/JJsoeM4Nbx0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/adwords-scripts/KzJed000000000000000000000000000000000000000000000T1LJUP000sO5zeMHR_6YwvcZ87cPrg%40sfdc.net.


--
======================================== 
株式会社アシロ 派生メディア事業部 広告グループ
北島 優人/Yuto Kitajima
 
〒160-0023 東京都新宿区西新宿 6-3-1 新宿アイランドウィング 4F 
TEL:03-6279-0875
FAX:03-6279-4582 
 ========================================
Reply all
Reply to author
Forward
0 new messages