{"record":{"id":"51fdcf57b78e133b","repo":"kubernetes/kops","slug":"error-querying-for-nlb-listeners-v","errorCode":null,"errorMessage":"error querying for NLB listeners :%v","messagePattern":"error querying for NLB listeners :(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/networkloadbalancerlistener.go","lineNumber":82,"sourceCode":"\t}\n\n\tloadBalancerArn := e.NetworkLoadBalancer.loadBalancerArn\n\tif loadBalancerArn == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tvar l *elbv2types.Listener\n\t{\n\t\trequest := &elbv2.DescribeListenersInput{\n\t\t\tLoadBalancerArn: &loadBalancerArn,\n\t\t}\n\t\t// TODO: Move to lbInfo?\n\t\tvar allListeners []elbv2types.Listener\n\t\tpaginator := elbv2.NewDescribeListenersPaginator(cloud.ELBV2(), request)\n\t\tfor paginator.HasMorePages() {\n\t\t\tpage, err := paginator.NextPage(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error querying for NLB listeners :%v\", err)\n\t\t\t}\n\t\t\tallListeners = append(allListeners, page.Listeners...)\n\t\t}\n\n\t\tvar matches []elbv2types.Listener\n\t\tfor _, listener := range allListeners {\n\t\t\tif aws.ToInt32(listener.Port) == int32(e.Port) {\n\t\t\t\tmatches = append(matches, listener)\n\t\t\t}\n\t\t}\n\t\tif len(matches) == 0 {\n\t\t\treturn nil, nil\n\t\t}\n\t\tif len(matches) > 1 {\n\t\t\treturn nil, fmt.Errorf(\"found multiple listeners matching %+v\", e)\n\t\t}\n\t\tl = &matches[0]\n\t}","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/networkloadbalancerlistener.go#L64-L100","documentation":"NetworkLoadBalancerListener.Find pages through ELBV2 DescribeListeners for the NLB and wraps any pagination error with this message. It means kOps could not enumerate the NLB's listeners, so it cannot compute the task's actual state.","triggerScenarios":"DescribeListenersPaginator.NextPage fails due to invalid listener/load balancer ARN, LoadBalancerNotFound, IAM permission missing on elasticloadbalancing:DescribeListeners, throttling, or network errors.","commonSituations":"NLB deleted out-of-band while its listeners task still exists; IAM role stripped of describe permissions; AWS API throttling on clusters with many listeners.","solutions":["Check the wrapped AWS error: LoadBalancerNotFound implies the NLB is gone — refresh or recreate it first","Verify IAM permissions for elasticloadbalancing:DescribeListeners","Retry on throttling (AWS error code ThrottlingException) with backoff","Confirm the load balancer ARN stored on the task is current"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// confirm the NLB exists before describing listeners\n_, err := cloud.ELBV2().DescribeLoadBalancers(&elbv2.DescribeLoadBalancersInput{LoadBalancerArns: []string{lbArn}})\nif err != nil { return nil, fmt.Errorf(\"NLB %s not found: %w\", lbArn, err) }","typeGuard":null,"tryCatchPattern":"page, err := paginator.NextPage(ctx)\nif err != nil {\n  if isThrottling(err) { /* backoff and retry page */ }\n  return nil, fmt.Errorf(\"error querying for NLB listeners :%v\", err)\n}","preventionTips":["Grant IAM elasticloadbalancing:DescribeListeners","Refresh kops state if the NLB was deleted out-of-band","Back off on ThrottlingException for clusters with many listeners","Retry transient network errors"],"tags":["aws","elbv2","listener","pagination"],"backgroundTag":"describe-listeners-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}