{"record":{"id":"d987c5020c4ee5a0","repo":"googleapis/mcp-toolbox","slug":"error-constructing-client-creator-w","errorCode":null,"errorMessage":"error constructing client creator: %w","messagePattern":"error constructing client creator: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/bigquery/bigquery.go","lineNumber":215,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error creating client from ADC: %w\", err)\n\t\t}\n\t\ts.Client = client\n\t\ts.RestService = restService\n\t\ts.TokenSource = tokenSource\n\n\t\tif r.WriteMode == WriteModeProtected {\n\t\t\t// session-based connections\n\t\t\ts.SessionProvider = s.newBigQuerySessionProvider()\n\t\t}\n\t} else {\n\t\tif strings.ToLower(r.UseClientOAuth) != \"true\" {\n\t\t\ts.AuthTokenHeaderName = r.UseClientOAuth\n\t\t}\n\t\t// use client OAuth\n\t\tbaseClientCreator, err := newBigQueryClientCreator(ctx, tracer, r.Project, r.Location, r.QuotaProject, r.Name, endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error constructing client creator: %w\", err)\n\t\t}\n\t\tsetupClientCaching(s, baseClientCreator)\n\t}\n\n\tallowedDatasets := make(map[string]struct{})\n\t// Get full id of allowed datasets and verify they exist.\n\tif len(r.AllowedDatasets) > 0 {\n\t\tfor _, allowed := range r.AllowedDatasets {\n\t\t\tvar projectID, datasetID, allowedFullID string\n\t\t\tif strings.Contains(allowed, \".\") {\n\t\t\t\tparts := strings.Split(allowed, \".\")\n\t\t\t\tif len(parts) != 2 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"invalid allowedDataset format: %q, expected 'project.dataset' or 'dataset'\", allowed)\n\t\t\t\t}\n\t\t\t\tprojectID = parts[0]\n\t\t\t\tdatasetID = parts[1]\n\t\t\t\tallowedFullID = allowed\n\t\t\t} else {","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/bigquery/bigquery.go#L197-L233","documentation":"When useClientOAuth is enabled, Initialize constructs a per-client creator via newBigQueryClientCreator, which sets up the machinery to create a BigQuery client from each end user's credentials at invocation time. Failure to build this creator (e.g. invalid endpoint or project configuration) is wrapped in this error.","triggerScenarios":"Initializing the BigQuery source with useClientOAuth enabled when newBigQueryClientCreator fails — typically due to an invalid/normalized API endpoint or unresolvable project/location/quotaProject parameters.","commonSituations":"Setting apiEndpoint to a malformed or unreachable host for restricted/VPC-SC environments; typos in project ID passed to the client creator; misconfigured options transport settings.","solutions":["Verify apiEndpoint is a valid BigQuery REST endpoint host (or remove it to use the default).","Check project and location values are correct and reachable.","Temporarily disable useClientOAuth to isolate whether the failure is in ADC or client-creator setup."],"exampleFix":"// before\napiEndpoint: bigquery.invalid-endpoint.googleapis.com\n// after\napiEndpoint: bigquery.googleapis.com","handlingStrategy":"validation","validationCode":"u, err := url.Parse(\"https://\" + endpoint)\nif err != nil || u.Host == \"\" {\n\treturn fmt.Errorf(\"apiEndpoint %q is not a valid host\", endpoint)\n}","typeGuard":null,"tryCatchPattern":"src, err := sourceRegistry.Initialize(ctx, cfg)\nif err != nil {\n\tif strings.Contains(err.Error(), \"error constructing client creator\") {\n\t\tlog.Printf(\"client creator setup failed; check apiEndpoint/project/location: %v\", err)\n\t\treturn err\n\t}\n\treturn err\n}","preventionTips":["Omit apiEndpoint unless connecting to a special endpoint; when set, use a bare valid hostname.","Confirm project and location values against the GCP console.","Test client-creator construction in a smoke test during CI."],"tags":["config","client","oauth","bigquery"],"backgroundTag":"client-initialization-failed","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}