{"record":{"id":"bdbc99f073a1dfea","repo":"kubernetes/kops","slug":"error-adding-tags-to-elbv2-q-v","errorCode":null,"errorMessage":"error adding tags to ELBV2 %q: %v","messagePattern":"error adding tags to ELBV2 %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_apitarget.go","lineNumber":87,"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\tmissing := map[string]string{}\n\tfor k, v := range expected {\n\t\tactualValue, found := actual[k]\n\t\tif found && actualValue == v {\n\t\t\tcontinue\n\t\t}\n\t\tmissing[k] = v\n\t}\n\n\tif len(missing) != 0 {\n\t\tklog.V(4).Infof(\"adding tags to %q: %v\", ResourceArn, missing)\n\t\terr := t.Cloud.CreateELBV2Tags(ResourceArn, missing)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error adding tags to ELBV2 %q: %v\", ResourceArn, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (t *AWSAPITarget) RemoveELBV2Tags(ResourceArn string, expected map[string]string) error {\n\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}","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_apitarget.go#L69-L105","documentation":"AWSAPITarget.AddELBV2Tags computes the set of missing tags and calls Cloud.CreateELBV2Tags; any SDK failure writing those tags is wrapped with this message including the resource ARN. Thrown only when at least one tag is missing.","triggerScenarios":"After diffing expected vs actual ELBV2 tags, CreateELBV2Tags(ResourceArn, missing) fails (throttling, permission, resource deleted concurrently, invalid tag value).","commonSituations":"IAM missing elasticloadbalancing:AddTags; tag values exceed AWS limits (256 chars) or use forbidden characters; ALB removed by another process; heavy automation causing DescribeTags/AddTags throttling.","solutions":["Grant elasticloadbalancing:AddTags to the kOps IAM role","Validate tag values (≤256 chars, no invalid characters) in the cluster spec (cluster.spec.tags / extraTags)","Re-run kops update cluster — idempotent retry after throttling or concurrent deletion","Check the wrapped error code for the precise cause"],"exampleFix":"// before\nerr := t.Cloud.CreateELBV2Tags(ResourceArn, missing)\nif err != nil {\n\treturn fmt.Errorf(\"error adding tags to ELBV2 %q: %v\", ResourceArn, err)\n}\n// after: retry throttling\nif code := awsup.AWSErrorCode(err); code == \"Throttling\" {\n\treturn fi.NewTryAgainLaterError(\"ELBV2 tags throttled\").WithError(err)\n}","handlingStrategy":"try-catch","validationCode":"for k, v := range expectedTags {\n\tif len(v) > 256 { return fmt.Errorf(\"tag %s value too long\", k) }\n}\nif !iamAllows(\"elasticloadbalancing:AddTags\") { return errors.New(\"IAM policy missing elasticloadbalancing:AddTags\") }","typeGuard":null,"tryCatchPattern":"err := target.AddELBV2Tags(arn, expectedTags)\nif err != nil {\n\tif strings.Contains(err.Error(), \"Throttling\") { time.Sleep(backoff); return retry() }\n\treturn err\n}","preventionTips":["Validate tag keys/values against AWS limits before apply","Grant elasticloadbalancing:AddTags to the kOps role","Set desired tags only through kOps spec so reconciliation is idempotent","Avoid external tag automation fighting kOps over the same ELBV2 tags"],"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"}