Request for Support: "The error code is not in this version" when using CampaignCriterionService in v18

101 views
Skip to first unread message

Route66_2 googleAPI

unread,
Dec 12, 2024, 5:03:56 AM12/12/24
to Google Ads API and AdWords API Forum

Hello.

I recently updated my Google Ads API client code from v17 to v18, but I’m encountering an unexpected error. The same code was working perfectly in v17. Here’s the error I get when running the updated version:

Request made: ClientCustomerId: XXXXXXXX, Host: googleads.googleapis.com, Method: /google.ads.googleads.v18.services.CampaignCriterionService/MutateCampaignCriteria, RequestId: SWOL-Ui2pIBXa-EqsxY_Gw, IsFault: True, FaultMessage: The error code is not in this version.

Here’s a simplified version of my code:


from google.ads.googleads.client import GoogleAdsClient

client = GoogleAdsClient.load_from_env(version="v17")  # Changed to "v18"

campaign_criterion_service = client.get_service("CampaignCriterionService")
campaign_criterion_operation = client.get_type("CampaignCriterionOperation")

campaign_criterion = campaign_criterion_operation.create
campaign_criterion.campaign = "campaign_resource_nameXXXX"
campaign_criterion.language.language_constant = "languageConstants/1005"  # Japanese

campaign_criterion_service.mutate_campaign_criteria(
    customer_id="customer_id", operations=[campaign_criterion_operation]
)


When I updated GoogleAdsClient.load_from_env(version="v17") to version="v18", the error started appearing.

I checked the release notes for v18, but I couldn’t find any mention of changes related to CampaignCriterionService or MutateCampaignCriteria.

I would appreciate any insights or suggestions for resolving this issue.

Thanks in advance!

Google Ads API Forum Advisor

unread,
Dec 12, 2024, 11:38:18 AM12/12/24
to route66...@gmail.com, adwor...@googlegroups.com

Hi,

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

From the provided logs, I understand that you have encountered the “UNKNOWN, The error code is not in this version” error while trying to mutate the Campaign Criteria and also I could see that the code was working perfectly as expected in V17 but generated an unknown error in V18. Kindly note that we have replicated your issue and successfully mutated the Campaign Criteria in V18. So I would recommend you to attempt the API request again.

If you still face any issues, please feel free to contact us.

This message is in relation to case "ref:!00D1U01174p.!5004Q02vGofk:ref" (ADR-00278541)

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5


 


Route66_2 googleAPI

unread,
Dec 16, 2024, 2:58:14 AM12/16/24
to Google Ads API and AdWords API Forum

Dear Google Ads API Support Team,

Thank you for your response and for replicating the issue on your side. However, I have attempted the API request again after updating my Python packages to the latest versions, and I am still encountering the same error:


google.ads.googleads.errors.GoogleAdsException: (<_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Request contains an invalid argument."
        debug_error_string = "UNKNOWN:Error received from peer ipv4:XXX.XXX.XXX.XXX:443 {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2024-12-13T11:28:47.891219+09:00"}"
>, <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "Request contains an invalid argument."
        debug_error_string = "UNKNOWN:Error received from peer ipv4:XXX.XXX.XXX.XXX:443 {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2024-12-13T11:28:47.891219+09:00"}"
>, errors {
  error_code {
    request_error: UNKNOWN
  }
  message: "The error code is not in this version."
  trigger {
    string_value: "OWNED_AND_OPERATED"
  }
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
    field_path_elements {
      field_name: "create"
    }
    field_path_elements {
      field_name: "language"
    }
  }
}
request_id: "S1q2EhUZJKqcW_dfodWnrQ"
, 'S1q2EhUZJKqcW_dfodWnrQ')



To provide more context, I have included the full source code below. If I change all instances of v17 to v18, the code no longer works.

====================

import uuid

from google.ads.googleads.client import GoogleAdsClient

YEN = 1000000

customer_id = "XXXXXXXXXXX"
client = GoogleAdsClient.load_from_env(version="v17")

# Create Campaign Budget
campaign_budget_service = client.get_service("CampaignBudgetService")
campaign_budget_operation = client.get_type("CampaignBudgetOperation")
campaign_budget = campaign_budget_operation.create
campaign_budget.name = f"Test Budget {uuid.uuid4()}"
campaign_budget.delivery_method = client.enums.BudgetDeliveryMethodEnum.STANDARD
campaign_budget.amount_micros = 1000 * YEN
campaign_budget.explicitly_shared = False
campaign_budget = campaign_budget_service.mutate_campaign_budgets(
customer_id=customer_id, operations=[campaign_budget_operation]
)

# Create Campaign
campaign_service = client.get_service("CampaignService")
campaign_operation = client.get_type("CampaignOperation")
campaign = campaign_operation.create
campaign.name = f"Test Campaign {uuid.uuid4()}"
campaign.advertising_channel_type = client.enums.AdvertisingChannelTypeEnum.DEMAND_GEN
campaign.status = client.enums.CampaignStatusEnum.ENABLED
campaign.campaign_budget = campaign_budget.results[0].resource_name
maximize_conversions = client.get_type("MaximizeConversions")
campaign.maximize_conversions = maximize_conversions
campaign = campaign_service.mutate_campaigns(customer_id=customer_id, operations=[campaign_operation])

# Create Campaign Criterion
campaign_criterion_service = client.get_service("CampaignCriterionService")
campaign_criterion_operation = client.get_type("CampaignCriterionOperation")
campaign_criterion = campaign_criterion_operation.create
campaign_criterion.campaign = campaign.results[0].resource_name
campaign_criterion.language.language_constant = "languageConstants/1005"
campaign_criterion_service.mutate_campaign_criteria(customer_id=customer_id, operations=[campaign_criterion_operation])

======================

Could you please take another look? I would greatly appreciate any further insights or advice on resolving this issue.

Thank you for your continued support.

Best regards,


2024年12月13日金曜日 1:38:18 UTC+9 Google Ads API Forum Advisor:

Google Ads API Forum Advisor

unread,
Dec 16, 2024, 8:05:05 AM12/16/24
to route66...@gmail.com, adwor...@googlegroups.com

Hi,

As you have mentioned that your code was working fine with the V17 version, please share the complete updated API logs (request and response with request-id and request header) generated at your end without redacting any information for the same request using the version V17 of the Google Ads API.

You can send the details via Reply privately to the author option, or direct private reply to this email.

Reply all
Reply to author
Forward
0 new messages