{"record":{"id":"540b153b78d946ad","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-query-q-w-540b15","errorCode":null,"errorMessage":"cannot query %q: %w","messagePattern":"cannot query %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/promscrape/discovery/yandexcloud/api.go","lineNumber":263,"sourceCode":"// getServiceEndpoints returns services endpoints map\n//\n// See https://cloud.yandex.com/en-ru/docs/api-design-guide/concepts/endpoints\nfunc (cfg *apiConfig) getServiceEndpoints(apiEndpoint string) (map[string]string, error) {\n\tapiEndpointURL, err := url.Parse(apiEndpoint)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot parse api_endpoint %q: %w\", apiEndpoint, err)\n\t}\n\tscheme := apiEndpointURL.Scheme\n\tif scheme == \"\" {\n\t\treturn nil, fmt.Errorf(\"missing scheme in api_endpoint %q\", apiEndpoint)\n\t}\n\tif apiEndpointURL.Host == \"\" {\n\t\treturn nil, fmt.Errorf(\"missing host in api_endpoint %q\", apiEndpoint)\n\t}\n\tendpointsURL := apiEndpoint + \"/endpoints\"\n\tresp, err := cfg.client.Get(endpointsURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot query %q: %w\", endpointsURL, err)\n\t}\n\tdata, err := readResponseBody(resp, endpointsURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar eps endpoints\n\tif err := json.Unmarshal(data, &eps); err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot parse API endpoints list: %w; data=%s\", err, data)\n\t}\n\tm := make(map[string]string, len(eps.Endpoints))\n\tfor _, endpoint := range eps.Endpoints {\n\t\tm[endpoint.ID] = scheme + \"://\" + endpoint.Address\n\t}\n\treturn m, nil\n}\n\ntype endpoints struct {\n\tEndpoints []endpoint `json:\"endpoints\"`","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/promscrape/discovery/yandexcloud/api.go#L245-L281","documentation":"After validating api_endpoint, getServiceEndpoints performs GET <api_endpoint>/endpoints to fetch the map of Yandex Cloud service endpoints. This error wraps the transport failure of that GET (DNS, connect, TLS, timeout). The full endpointsURL is included so you can test it directly.","triggerScenarios":"cfg.client.Get(endpointsURL) fails: api host unreachable, DNS resolution failure, TLS error, firewall egress block, or request timeout while fetching /endpoints.","commonSituations":"Air-gapped or firewalled clusters without egress to api.cloud.yandex.net; wrong custom api_endpoint host; DNS misconfiguration in containers; transient network outages during scrape-config reload.","solutions":["Fix the root cause shown by the wrapped error (DNS/TLS/timeout) after inspecting it","Verify reachability: curl https://api.cloud.yandex.net/endpoints from the VictoriaMetrics host","Open egress (firewall/proxy) to the Yandex API endpoint on 443","Correct the api_endpoint if it points to a nonexistent host"],"exampleFix":"// before: firewalled host\nyandexcloud_sd_configs: [{ api_endpoint: \"https://api-unreachable.example.net\" }]\n// after\nyandexcloud_sd_configs: [{ api_endpoint: \"https://api.cloud.yandex.net\" }]","handlingStrategy":"retry","validationCode":"endpointsURL := strings.TrimRight(apiEndpoint, \"/\") + \"/endpoints\"\nresp, err := http.Get(endpointsURL)\nif err != nil {\n    return fmt.Errorf(\"endpoints URL unreachable from this host: %w\", err)\n}\nresp.Body.Close()","typeGuard":null,"tryCatchPattern":"eps, err := cfg.getServiceEndpoints(apiEndpoint)\nif err != nil {\n    if isTransientNetErr(err) {\n        return getServiceEndpointsWithBackoff(cfg, apiEndpoint) // bounded retries\n    }\n    return fmt.Errorf(\"cannot reach Yandex /endpoints; check DNS and egress: %w\", err)\n}","preventionTips":["Confirm egress on 443 to the Yandex API host from the scraper machine","Test with curl <api_endpoint>/endpoints before enabling discovery","Fix container/pod DNS configuration if lookups fail","Alert on repeated /endpoints fetch failures during config reloads"],"tags":["network","http-get","dns","yandex-cloud","service-discovery"],"backgroundTag":"http-request-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"}