When mutating a resource that contains a union field, if there is a missing required field on the union field data, that required field name is not returned in the error message.
This masks what the actual error is and what field is required.
In my example below, attempting to create a Responsive Display Ad fails because a required field is missing from the ad_data union field. Which field is missing is not returned to the user in the error message.
request-id=zKmpiwHTBsCVrlE8bqiZbg
Request
-------
MethodName: google.ads.googleads.v10.services.AdGroupAdService/MutateAdGroupAds
Endpoint:
googleads.googleapis.com:443Headers: {developer-token=REDACTED, login-customer-id=ABC, x-goog-api-client=gl-java/11.0.13 gccl/17.0.1 gapic/17.0.1 gax/2.6.1 grpc/1.41.0}
Body: customer_id: "XYZ"
operations {
create {
status: ENABLED
ad {
type: RESPONSIVE_DISPLAY_AD
responsive_display_ad {
marketing_images {
asset: "customers/ABC/assets/XYZ"
}
marketing_images {
asset: "customers/ABC/assets/XYZ"
}
marketing_images {
asset: "customers/ABC/assets/XYZ"
}
marketing_images {
asset: "customers/ABC/assets/XYZ"
}
marketing_images {
asset: "customers/ABC/assets/XYZ"
}
marketing_images {
asset: "customers/ABC/assets/XYZ"
}
square_marketing_images {
asset: "customers/ABC/assets/XYZ"
}
square_marketing_images {
asset: "customers/ABC/assets/XYZ"
}
square_marketing_images {
asset: "customers/ABC/assets/XYZ"
}
square_marketing_images {
asset: "customers/ABC/assets/XYZ"
}
square_marketing_images {
asset: "customers/ABC/assets/XYZ"
}
square_marketing_images {
asset: "customers/ABC/assets/XYZ"
}
headlines {
text: removed
}
headlines {
text: removed
}
headlines {
text: removed
}
headlines {
text: removed
}
descriptions {
text: removed
}
descriptions {
text: removed
}
descriptions {
text: removedAmenity Space."
}
format_setting: ALL_FORMATS
business_name: removed
allow_flexible_color: true
}
final_urls: removed
}
ad_group: "customers/ABC/adGroups/XYZ"
}
}
partial_failure: true
Response
--------
Headers: Metadata(content-disposition=attachment,content-type=application/grpc,request-id=zKmpiwHTBsCVrlE8bqiZbg,date=Tue, 22 Feb 2022 15:15:06 GMT,alt-svc=h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43")
Body: results {
}
partial_failure_error {
code: 3
message: "The required field was not present., at operations[0].create.ad.responsive_display_ad"
details {
type_url: "
type.googleapis.com/google.ads.googleads.v10.errors.GoogleAdsFailure"
value: "\ne\n\003\350\003\002\022#The required field was not present.\"9\022\016\n\noperations\030\000\022\b\n\006create\022\004\n\002ad\022\027\n\025responsive_display_ad"
}
}
Failure message: null
Status: Status{code=OK, description=null, cause=null}.
As you can see, we are told that "The required field was not present" in the error response, but we are not told which field is missing.
Pete