{"record":{"id":"334d99d120a808f8","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-create-client-for-q-w-334d99","errorCode":null,"errorMessage":"cannot create client for %q: %w","messagePattern":"cannot create client for %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/promscrape/discovery/vultr/api.go","lineNumber":52,"sourceCode":"\t// See: https://www.vultr.com/api/\n\tapiServer := \"https://api.vultr.com\"\n\n\tif sdc.HTTPClientConfig.BearerToken == nil {\n\t\treturn nil, fmt.Errorf(\"missing `bearer_token` option\")\n\t}\n\n\tac, err := sdc.HTTPClientConfig.NewConfig(baseDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot parse auth config: %w\", err)\n\t}\n\tproxyAC, err := sdc.ProxyClientConfig.NewConfig(baseDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot parse proxy auth config: %w\", err)\n\t}\n\n\tc, err := discoveryutil.NewClient(apiServer, ac, sdc.ProxyURL, proxyAC, &sdc.HTTPClientConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot create client for %q: %w\", apiServer, err)\n\t}\n\n\t// Prepare additional query params for list instance API.\n\t// See https://www.vultr.com/api/#tag/instances/operation/list-instances\n\tvar qp url.Values\n\tif sdc.Label != \"\" {\n\t\tqp.Set(\"label\", sdc.Label)\n\t}\n\tif sdc.MainIP != \"\" {\n\t\tqp.Set(\"main_ip\", sdc.MainIP)\n\t}\n\tif sdc.Region != \"\" {\n\t\tqp.Set(\"region\", sdc.Region)\n\t}\n\tif sdc.FirewallGroupID != \"\" {\n\t\tqp.Set(\"firewall_group_id\", sdc.FirewallGroupID)\n\t}\n\tif sdc.Hostname != \"\" {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/promscrape/discovery/vultr/api.go#L34-L70","documentation":"This error wraps any failure from discoveryutil.NewClient when building the HTTP client used to talk to the Vultr API. NewClient validates proxy auth configs and the HTTP client config (TLS, headers, etc.), so the error means the transport layer for reaching apiServer could not be constructed. It is thrown eagerly at SD-config processing time, before any scrape happens.","triggerScenarios":"Invalid proxy_url with bad credentials or unsupported scheme in the SDConfig; invalid http_client_config (bad TLS CA/cert/key files, malformed authorization block, bad oauth2 settings); apiServer URL that NewClient cannot handle.","commonSituations":"Typo in proxy credentials or proxy_basic_auth username/password; TLS ca/cert files referenced with paths that do not exist relative to baseDir; copying a Prometheus-style http_client_config with unsupported fields; environment where the proxy requires auth that was not configured.","solutions":["Check the wrapped %w cause: it names the exact field (proxy auth, TLS, authorization) that failed to parse.","Verify proxy_url and its proxy_*_auth credentials are correct and the scheme is http/https.","Ensure all files referenced by http_client_config TLS settings exist and are readable from baseDir.","Remove or fix unsupported http_client_config fields; test the config with a minimal SDConfig first."],"exampleFix":"// before\nproxy_url: \"http://bad-scheme-proxy.internal:3128\"\n// after\nproxy_url: \"http://proxy.internal:3128\"\nproxy_basic_auth:\n  username: \"scraper\"\n  password_file: \"proxy_password\"","handlingStrategy":"validation","validationCode":"if cfg.ProxyURL != \"\" {\n    u, err := url.Parse(cfg.ProxyURL)\n    if err != nil || (u.Scheme != \"http\" && u.Scheme != \"https\") {\n        return fmt.Errorf(\"invalid proxy_url %q\", cfg.ProxyURL)\n    }\n}\nfor _, f := range []string{cfg.HTTPClientConfig.TLSConfig.CAFile, cfg.HTTPClientConfig.TLSConfig.CertFile, cfg.HTTPClientConfig.TLSConfig.KeyFile} {\n    if f != \"\" {\n        if _, err := os.Stat(filepath.Join(baseDir, f)); err != nil {\n            return fmt.Errorf(\"TLS/auth file missing: %s\", f)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep proxy and TLS file paths relative to baseDir and verify them in CI config linting","Use secrets mounted at stable paths with correct permissions","Test SD configs with minimal fields before adding proxy/TLS options"],"tags":["http-client","proxy","tls","config-validation","vultr-sd"],"backgroundTag":"http-client-construction-failed","analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}