Here's my code
```
internal string GenerateKeywordHistoricalMetricsByKeyword_2(GoogleAdsClient client,
string ccid,
string product_url,
string language,
string location,
string network,
string attribute,
string adgroup,
string v,
bool debug)
{
TraceUtilities.Configure(TraceUtilities.DETAILED_REQUEST_LOGS_SOURCE,
$"C:\\logs\\GenerateKeywordHistoricalMetricsByKeyword_2_{Me}_{System.Guid.NewGuid()}_trace.log",
System.Diagnostics.SourceLevels.All);
if (debug) Debugger.Launch();
if (network == "Gcsp") network = "GoogleSearch";
KeywordPlanIdeaServiceClient keywordPlanIdeaService =
client.GetService(Services.V18.KeywordPlanIdeaService);
GenerateKeywordHistoricalMetricsRequest request =
new GenerateKeywordHistoricalMetricsRequest();
request.CustomerId = ccid;
request.Keywords.AddRange(from word in product_url.Split(',') select word.Trim());
request.GeoTargetConstants.AddRange(NamedToId(location));
request.Language = language;
request.KeywordPlanNetwork = GetNetwork(network);
request.IncludeAdultKeywords = false;
request.HistoricalMetricsOptions = new Google.Ads.GoogleAds.V18.Common.HistoricalMetricsOptions()
{
IncludeAverageCpc = true
};
//request.AggregateMetrics.AggregateMetricTypes.Add(KeywordPlanAggregateMetricTypeEnum.Types.KeywordPlanAggregateMetricType.Device);
try
{
GenerateKeywordHistoricalMetricsResponse response =
keywordPlanIdeaService.GenerateKeywordHistoricalMetrics(request);
return JsonConvert.SerializeObject(response);
}
catch (Exception e)
{
return JsonConvert.SerializeObject(e.Message);
}
}
```
It fails in the try block. The TraceUtilities call generates an empty file. The Exception's e.Message contains
```
"Status(StatusCode=\"PermissionDenied\", Detail=\"The caller does not have permission\", DebugException=\"Grpc.Core.Internal.CoreErrorDetailException: {\"created\":\"@1729751872.851000000\",\"description\":\"Error received from peer ipv4:
142.250.70.170:443\",\"file\":\"..\\..\\..\\src\\core\\lib\\surface\\call.cc\",\"file_line\":1070,\"grpc_message\":\"The caller does not have permission\",\"grpc_status\":7}\")"
```
I am utterly mystified. What does "The caller does not have permission" mean? If it's to do with the login-customer-id, that can be seen in the `client` object at `LoginCustomerId` and hold a meaningful value.