{"record":{"id":"4069abb66aefecd6","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-get-organizations-w","errorCode":null,"errorMessage":"cannot get organizations: %w","messagePattern":"cannot get organizations: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/promscrape/discovery/yandexcloud/yandexcloud.go","lineNumber":216,"sourceCode":"}\n\ntype cloud struct {\n\tName           string            `json:\"name\"`\n\tID             string            `json:\"id\"`\n\tLabels         map[string]string `json:\"labels\"`\n\tOrganizationID string            `json:\"organizationId\"`\n\tDescription    string            `json:\"description\"`\n\tCreatedAt      time.Time         `json:\"createdAt\"`\n}\n\nfunc (cfg *apiConfig) getOrganizations() ([]organization, error) {\n\torgsURL := cfg.serviceEndpoints[\"organization-manager\"] + \"/organization-manager/v1/organizations\"\n\tvar orgs []organization\n\tnextLink := orgsURL\n\tfor {\n\t\tdata, err := getAPIResponse(nextLink, cfg)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot get organizations: %w\", err)\n\t\t}\n\t\tvar op organizationsPage\n\t\tif err := json.Unmarshal(data, &op); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot parse organizations response from %q: %w; response body: %s\", nextLink, err, data)\n\t\t}\n\t\torgs = append(orgs, op.Organizations...)\n\t\tif len(op.NextPageToken) == 0 {\n\t\t\treturn orgs, nil\n\t\t}\n\t\tnextLink = orgsURL + \"&pageToken=\" + url.QueryEscape(op.NextPageToken)\n\t}\n}\n\n// See https://cloud.yandex.com/en-ru/docs/organization/api-ref/Organization/list\ntype organizationsPage struct {\n\tOrganizations []organization `json:\"organizations\"`\n\tNextPageToken string         `json:\"nextPageToken\"`\n}","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/promscrape/discovery/yandexcloud/yandexcloud.go#L198-L234","documentation":"Wrapped error from getOrganizations: the call to organization-manager /v1/organizations (including paginated follows) failed at the transport/HTTP level via getAPIResponse. The underlying cause is preserved with %w. This happens before any clouds are listed, so Yandex Cloud SD produces no targets.","triggerScenarios":"getAPIResponse(nextLink, cfg) errors on the organizations list or any nextPageToken page: invalid token, network failure, HTTP 4xx/5xx, or concurrency-limit rejection from the shared discovery client.","commonSituations":"Missing/invalid IAM credentials for the organization-manager API; service account lacking permission to list organizations; DNS or egress firewall issues; API-side throttling.","solutions":["Read the wrapped cause in the log for the actual HTTP status or network error","Grant the service account organization-manager viewer permissions","Verify the credentials configured for yandexcloud_sd are current","Confirm outbound HTTPS access to the organization-manager service endpoint from the scrape host"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify org listing works before enabling sd\nresp, err := http.Get(orgManagerURL + \"/organization-manager/v1/organizations\")\nif err != nil || resp.StatusCode == 401 || resp.StatusCode == 403 { /* fix token/permissions */ }","typeGuard":null,"tryCatchPattern":"orgs, err := cfg.getOrganizations()\nif err != nil {\n\tlog.Printf(\"yandexcloud sd organizations: %v\", err)\n\treturn cachedTargets, nil\n}","preventionTips":["Grant the service account organization-manager viewer role","Alert on discovery refresh error logs","Validate credentials in CI before deployment"],"tags":["golang","network","service-discovery","yandex-cloud","promscrape"],"backgroundTag":"cloud-discovery-api-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"}