Error running unmodified Python democontext_error: OPERATION_NOT_PERMITTED_FOR_CONTEXT

32 views
Skip to first unread message

Jakob Steixner

unread,
Jun 28, 2023, 4:57:48 AM6/28/23
to Google Ads API and AdWords API Forum
Hi, 

I am currently getting an error trying to run the unchanged Python demo for `add_campaigns.py`, specifically in line 49 when trying to specify the campaign budget. (https://github.com/googleads/google-ads-python/blob/main/examples/basic_operations/add_campaigns.py#L49)

Could this be related to trying to use the wrong type of account (i.e. manager account vs. client account)? Or to insufficient funds being allocated to the account?

Thank you very much!

Here is the error response:

(<_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:142.251.208.106:443 {created_time:"2023-06-28T10:39:27.303527057+02:00", grpc_status:3, grpc_message:"Request contains an invalid argument."}"
>, <_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:142.251.208.106:443 {created_time:"2023-06-28T10:39:27.303527057+02:00", grpc_status:3, grpc_message:"Request contains an invalid argument."}"
>, errors {
  error_code {
    context_error: OPERATION_NOT_PERMITTED_FOR_CONTEXT
  }
  message: "The operation is not allowed for the given context."
  location {
    field_path_elements {
      field_name: "operations"
      index: 0
    }
  }
}
request_id: "fhNCjYqn53q4wK_YM9hdLA"
, 'fhNCjYqn53q4wK_YM9hdLA')

Google Ads API Forum Advisor

unread,
Jun 29, 2023, 10:29:18 AM6/29/23
to jakob.m....@gmail.com, adwor...@googlegroups.com

Hi Jakob,

Thanks for reaching out to the Google Ads API Forum.

I understand that you have encountered an OPERATION_NOT_PERMITTED_FOR_CONTEXT error, however, provided log snippets are not sufficient for us to check if said error is due to using the wrong type of account. If your request is sent for the Manager account and not for the client account then this error is intended here. You may note that the campaign creation should be under client account instead.

If you use a client account and the issue persists, then our team requires the complete request and response logs with the request-id generated for API error. To enable logging, you may refer here https://developers.google.com/google-ads/api/docs/best-practices/logging#python

Kindly provide the requested logs via reply privately to author option. 

This message is in relation to case "ref:_00D1U1174p._5004Q2mp98L:ref"

Thanks,
 
Google Logo Google Ads API Team

 



Reply all
Reply to author
Forward
0 new messages