{"record":{"id":"716cdd8d7aedb91f","repo":"kubernetes/kops","slug":"error-fetching-gce-managed-instance-group-members","errorCode":null,"errorMessage":"error fetching GCE managed instance group members for %q: %v","messagePattern":"error fetching GCE managed instance group members for %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/gce/identify.go","lineNumber":259,"sourceCode":"}\n\n// getManagedInstance queries GCE for the instance from the MIG\nfunc (i *nodeIdentifier) getManagedInstance(ctx context.Context, mig *compute.InstanceGroupManager, instanceID uint64) (*compute.ManagedInstance, error) {\n\tvar matches []*compute.ManagedInstance\n\n\tfilter := \"id=\" + strconv.FormatUint(instanceID, 10)\n\tzone := lastComponent(mig.Zone)\n\tif err := i.computeService.InstanceGroupManagers.ListManagedInstances(i.project, zone, mig.Name).Filter(filter).Pages(ctx, func(page *compute.InstanceGroupManagersListManagedInstancesResponse) error {\n\t\t// Post-filter... filters aren't implemented (b/27605549)\n\t\tfor _, instance := range page.ManagedInstances {\n\t\t\tif instance.Id != instanceID {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tmatches = append(matches, instance)\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"error fetching GCE managed instance group members for %q: %v\", mig.Name, err)\n\t}\n\n\tif len(matches) == 0 {\n\t\treturn nil, fmt.Errorf(\"instance %v not managed by mig %s\", instanceID, mig.Name)\n\t}\n\tif len(matches) > 1 {\n\t\t// Should be impossible - shows that filters / post-filters are not working\n\t\treturn nil, fmt.Errorf(\"found multiple instances with id %v managed by mig %s\", instanceID, mig.Name)\n\t}\n\n\treturn matches[0], nil\n}\n\n// lastComponent returns the last component of a URL, i.e. anything after the last slash\n// If there is no slash, returns the whole string\nfunc lastComponent(s string) string {\n\tlastSlash := strings.LastIndex(s, \"/\")\n\tif lastSlash != -1 {","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/gce/identify.go#L241-L277","documentation":"While enumerating members of a GCE managed instance group, the paginated ListInstances call failed, so kops cannot match the kubelet instance ID to a GCE instance. This wraps the error from iterating MIG members and is distinct from the case where the list succeeds but contains no match.","triggerScenarios":"The iterator over i.computeService.InstanceGroupManagers.ListInstances(project, zone, migName, filter) returns a non-nil error mid-pagination: rate limiting (429), transient 5xx, permission failure on compute.instanceGroupManagers.listInstances, or network interruption.","commonSituations":"Large MIGs requiring multiple pages hitting API quota; IAM changes removing list permission during operation; brief GCE API outage while a node registers.","solutions":["Retry; this call is often transient (quota or 5xx)","Check IAM for compute.instanceGroupManagers.listInstances on the project","Reduce API call pressure / increase quota for the controller's service account","Verify MIG and zone are correct via gcloud describe"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure IAM + quota before listing\n// gcloud projects get-iam-policy && check compute.instanceGroupManagers.listInstances","typeGuard":null,"tryCatchPattern":"inst, err := getManagedInstance(mig, id)\nif err != nil {\n  if strings.Contains(err.Error(), \"fetching GCE managed instance group members\") { /* transient: retry with backoff */ }\n  return err\n}","preventionTips":["Enable exponential backoff on GCE API calls","Raise API quota for controllers managing large MIGs","Alert on 403s to catch IAM regressions early"],"tags":["gce","node-identity","pagination","rate-limit"],"backgroundTag":"gcp-api-fetch-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}