{"record":{"id":"ff7550f54794e285","repo":"kubernetes/kops","slug":"target-group-not-yet-created-arn-not-set","errorCode":null,"errorMessage":"target group not yet created (arn not set)","messagePattern":"target group not yet created \\(arn not set\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/networkloadbalancerlistener.go","lineNumber":178,"sourceCode":"\t\tklog.Warningf(\"deleting ELB listener %q for required changes (%+v)\", a.listenerArn, changes)\n\n\t\t// delete the listener before recreating it\n\t\t_, err := t.Cloud.ELBV2().DeleteListener(ctx, &elbv2.DeleteListenerInput{\n\t\t\tListenerArn: &a.listenerArn,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error deleting load balancer listener with arn=%q: %w\", e.listenerArn, err)\n\t\t}\n\t\ta = nil\n\t}\n\n\tif a == nil {\n\t\tif e.TargetGroup == nil {\n\t\t\treturn fi.RequiredField(\"TargetGroup\")\n\t\t}\n\t\ttargetGroupARN := fi.ValueOf(e.TargetGroup.ARN)\n\t\tif targetGroupARN == \"\" {\n\t\t\treturn fmt.Errorf(\"target group not yet created (arn not set)\")\n\t\t}\n\t\trequest := &elbv2.CreateListenerInput{\n\t\t\tDefaultActions: []elbv2types.Action{\n\t\t\t\t{\n\t\t\t\t\tTargetGroupArn: aws.String(targetGroupARN),\n\t\t\t\t\tType:           elbv2types.ActionTypeEnumForward,\n\t\t\t\t},\n\t\t\t},\n\t\t\tLoadBalancerArn: aws.String(loadBalancerArn),\n\t\t\tPort:            aws.Int32(int32(e.Port)),\n\t\t}\n\n\t\tif e.SSLCertificateID != \"\" {\n\t\t\trequest.Certificates = []elbv2types.Certificate{}\n\t\t\trequest.Certificates = append(request.Certificates, elbv2types.Certificate{\n\t\t\t\tCertificateArn: aws.String(e.SSLCertificateID),\n\t\t\t})\n\t\t\trequest.Protocol = elbv2types.ProtocolEnumTls","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/networkloadbalancerlistener.go#L160-L196","documentation":"When creating a new listener (a == nil), RenderAWS resolves the target group ARN from e.TargetGroup.ARN; if empty, the target group hasn't been created yet and this error is returned. A listener's forward action requires an existing target group ARN.","triggerScenarios":"TargetGroup task not yet applied (ARN unset) when the listener renders; target group creation failed earlier in the apply; task dependency not declared so ordering is wrong.","commonSituations":"First cluster bring-up with a failing target group step (e.g. VPC/subnet errors) that leaves the TG absent; missing dependency wiring between listener and target group tasks.","solutions":["Check earlier apply logs for target group creation errors and fix the root cause","Ensure the listener task references the TargetGroup task so fi orders it correctly","Re-run kops update cluster once the target group exists","Verify the target group's VPC matches the NLB's VPC to avoid downstream create failures"],"exampleFix":"// before: standalone TG reference\nlistener.TargetGroup = &NetworkLoadBalancerTargetGroup{Name: aws.String(\"api\")}\n// after: link the task for ordering\nlistener.TargetGroup = tgTask // the actual task instance in the target map","handlingStrategy":"validation","validationCode":"if e.TargetGroup == nil { return fi.RequiredField(\"TargetGroup\") }\nif fi.ValueOf(e.TargetGroup.ARN) == \"\" {\n  return fmt.Errorf(\"ensure the NetworkLoadBalancerTargetGroup task succeeded before the listener\")\n}","typeGuard":null,"tryCatchPattern":"targetGroupARN := fi.ValueOf(e.TargetGroup.ARN)\nif targetGroupARN == \"\" {\n  return fmt.Errorf(\"target group not yet created (arn not set)\")\n}\n// inspect earlier target-group errors, then re-run apply","preventionTips":["Link the TargetGroup task instance on the listener task so fi enforces ordering","Fix target group creation errors before listener creation","Ensure target group and NLB share the same VPC","Re-run apply only after confirming TG exists in AWS"],"tags":["aws","elbv2","listener","target-group","task-ordering"],"backgroundTag":"target-group-arn-not-set","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"}