{"record":{"id":"0f54d62f69abc2ed","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-create-client-for-q-w","errorCode":null,"errorMessage":"cannot create client for %q: %w","messagePattern":"cannot create client for %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/promscrape/discovery/azure/api.go","lineNumber":118,"sourceCode":"\t\treturn nil, fmt.Errorf(\"cannot parse proxy auth config: %w\", err)\n\t}\n\n\tenvironment := sdc.Environment\n\tif environment == \"\" {\n\t\tenvironment = \"AZURECLOUD\"\n\t}\n\tenv, err := getCloudEnvByName(environment)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot read configs for `environment: %q`: %w\", environment, err)\n\t}\n\n\trefreshToken, err := getRefreshTokenFunc(sdc, ac, proxyAC, env)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc, err := discoveryutil.NewClient(env.ResourceManagerEndpoint, ac, sdc.ProxyURL, proxyAC, &sdc.HTTPClientConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create client for %q: %w\", env.ResourceManagerEndpoint, err)\n\t}\n\t// It's already verified in discoveryutil.NewClient so no need to check err.\n\tu, _ := url.Parse(c.APIServer())\n\n\tcfg := &apiConfig{\n\t\tc:              c,\n\t\tapiServerHost:  u.Hostname(),\n\t\tport:           port,\n\t\tresourceGroup:  sdc.ResourceGroup,\n\t\tsubscriptionID: sdc.SubscriptionID,\n\t\ttenantID:       sdc.TenantID,\n\n\t\trefreshToken: refreshToken,\n\t}\n\treturn cfg, nil\n}\n\nfunc getCloudEnvByName(name string) (*cloudEnvironmentEndpoints, error) {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/promscrape/discovery/azure/api.go#L100-L136","documentation":"After obtaining a refresh token function, newAPIConfig builds an HTTP client for the Azure Resource Manager endpoint with discoveryutil.NewClient. If client construction fails (bad proxy URL, TLS/auth config problems), the error is wrapped with the ResourceManager endpoint name in this message.","triggerScenarios":"discoveryutil.NewClient(env.ResourceManagerEndpoint, ac, sdc.ProxyURL, proxyAC, &sdc.HTTPClientConfig) returns an error: invalid `proxy_url`, bad HTTP client config/TLS settings, or invalid endpoint URL parsing.","commonSituations":"Malformed `proxy_url` (missing scheme), self-signed CA files not present, or HTTPClientConfig options like oauth2 misconfigured for the Azure endpoint.","solutions":["Read the wrapped underlying error for the precise cause","Fix the `proxy_url` value (must be a valid absolute URL)","Check all file paths in the `http_client_config` TLS section exist and are readable","Remove unnecessary auth/TLS options if connecting directly to Azure public endpoints"],"exampleFix":"# before\nproxy_url: \"proxy.corp.local:3128\"\n# after\nproxy_url: \"http://proxy.corp.local:3128\"","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute proxy URLs with scheme"],"tags":["network","azure","http-client","config"],"backgroundTag":"http-client-creation-failed","analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}