{"record":{"id":"3bbaae92c26a21ba","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-parse-organizations-response-from-q-w-r","errorCode":null,"errorMessage":"cannot parse organizations response from %q: %w; response body: %s","messagePattern":"cannot parse organizations response from %q: %w; response body: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/promscrape/discovery/yandexcloud/yandexcloud.go","lineNumber":220,"sourceCode":"\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}\n\ntype organization struct {\n\tName        string            `json:\"name\"`\n\tID          string            `json:\"id\"`","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/promscrape/discovery/yandexcloud/yandexcloud.go#L202-L238","documentation":"getOrganizations received a response but json.Unmarshal failed to decode it into organizationsPage ({organizations, nextPageToken}). The URL and full response body are included in the message. Indicates the body was not the expected JSON document.","triggerScenarios":"API returns a non-list payload (error envelope, empty/HTML body, proxy interception) for the organizations list or a paginated page; or Yandex changed the response schema.","commonSituations":"Proxy/captive portal returning HTML; token accepted but payload is a permission-denied error JSON; stale VictoriaMetrics version incompatible with a changed Yandex API response format.","solutions":["Examine the embedded response body to see what was actually returned","If it's an error envelope, fix auth/permissions indicated there","Bypass any HTTP proxy or fix its configuration so raw JSON arrives","Upgrade VictoriaMetrics if the Yandex API response format changed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var probe struct{ Organizations []json.RawMessage `json:\"organizations\"` }\nif err := json.Unmarshal(body, &probe); err != nil {\n\tlog.Printf(\"unexpected org response: %.200s\", body)\n}","typeGuard":"func looksLikeOrganizationsPage(b []byte) bool {\n\tvar probe struct{ Organizations []json.RawMessage `json:\"organizations\"` }\n\treturn json.Unmarshal(b, &probe) == nil\n}","tryCatchPattern":"if err != nil {\n\tlog.Printf(\"org list unparsable: %v; body head: %.100s\", err, body)\n}","preventionTips":["Bypass or correctly configure proxies for cloud API traffic","Verify role/permissions when error envelopes appear","Upgrade the scraper when the provider changes its API schema"],"tags":["golang","json","service-discovery","yandex-cloud","response-parsing"],"backgroundTag":"json-unmarshal-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"}