{"record":{"id":"bf69f91ddbbd2c3a","repo":"kubernetes/kops","slug":"error-removing-tags-from-elbv2-q-v","errorCode":null,"errorMessage":"error removing tags from ELBV2 %q: %v","messagePattern":"error removing tags from ELBV2 %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_apitarget.go","lineNumber":113,"sourceCode":"\tactual, err := t.Cloud.GetELBV2Tags(ResourceArn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unexpected error fetching tags for resource: %v\", err)\n\t}\n\n\textra := map[string]string{}\n\tfor k, v := range actual {\n\t\texpectedValue, found := expected[k]\n\t\tif found && expectedValue == v {\n\t\t\tcontinue\n\t\t}\n\t\textra[k] = v\n\t}\n\n\tif len(extra) != 0 {\n\t\tklog.V(4).Infof(\"removing tags from %q: %v\", ResourceArn, extra)\n\t\terr := t.Cloud.RemoveELBV2Tags(ResourceArn, extra)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error removing tags from ELBV2 %q: %v\", ResourceArn, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (t *AWSAPITarget) WaitForInstanceRunning(instanceID string) error {\n\tattempt := 0\n\tfor {\n\t\tinstance, err := t.Cloud.DescribeInstance(instanceID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error while waiting for instance to be running: %v\", err)\n\t\t}\n\n\t\tif instance == nil {\n\t\t\t// TODO: Wait if we _just_ created the instance?\n\t\t\treturn fmt.Errorf(\"instance not found while waiting for instance to be running\")\n\t\t}","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_apitarget.go#L95-L131","documentation":"AWSAPITarget.RemoveELBV2Tags deletes tags found on the ELBV2 resource that are not in the expected set; failures from Cloud.RemoveELBV2Tags (elasticloadbalancing:RemoveTags API) are wrapped with this message and the ARN. Only thrown when there is at least one extra tag to remove.","triggerScenarios":"After diffing, RemoveELBV2Tags(ResourceArn, extra) fails — permissions, throttling, resource deleted concurrently, or invalid TagKey list.","commonSituations":"IAM missing elasticloadbalancing:RemoveTags; tags were added by external tooling (e.g. cost tagging policies) and kOps fights over them; resource deleted between fetch and remove.","solutions":["Grant elasticloadbalancing:RemoveTags to the kOps IAM role","Remove the conflicting tags via kops spec (don't add them manually) or exclude them from expected tags if a policy requires them","Re-run kops update cluster to retry after throttling or concurrent deletion","Check the wrapped error code for the precise API failure"],"exampleFix":"// before\nerr := t.Cloud.RemoveELBV2Tags(ResourceArn, extra)\nif err != nil {\n\treturn fmt.Errorf(\"error removing tags from ELBV2 %q: %v\", ResourceArn, err)\n}\n// after: retry throttling\nif code := awsup.AWSErrorCode(err); code == \"Throttling\" {\n\treturn fi.NewTryAgainLaterError(\"ELBV2 tag removal throttled\").WithError(err)\n}","handlingStrategy":"try-catch","validationCode":"if !iamAllows(\"elasticloadbalancing:RemoveTags\") { return errors.New(\"IAM policy missing elasticloadbalancing:RemoveTags\") }\n// confirm extra tags actually exist and are safe to remove\nout, _ := elbv2.DescribeTags(&elbv2.DescribeTagsInput{ResourceArns: []string{arn}})\nfor _, td := range out.TagDescriptions { for k := range td.Tags { _ = k } }","typeGuard":null,"tryCatchPattern":"err := target.RemoveELBV2Tags(arn, expectedTags)\nif err != nil {\n\tif strings.Contains(err.Error(), \"Throttling\") { time.Sleep(backoff); return retry() }\n\treturn err\n}","preventionTips":["Grant elasticloadbalancing:RemoveTags to the kOps role","Don't hand-tag kOps-managed load balancers with tags not in the spec","Manage cost-tagging policies so they don't conflict with kOps expected tags","Re-run apply to converge after any throttling-induced partial failure"],"tags":["aws","elbv2","tags"],"backgroundTag":"aws-tag-write-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"}