{"record":{"id":"738a565d9e00a2af","repo":"kubernetes/kops","slug":"unexpected-error-fetching-tags-for-resource-v","errorCode":null,"errorMessage":"unexpected error fetching tags for resource: %v","messagePattern":"unexpected error fetching tags for resource: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awsup/aws_apitarget.go","lineNumber":71,"sourceCode":"\treturn t.Cloud.GetTags(id)\n}\n\nfunc (t *AWSAPITarget) CreateTags(id string, tags map[string]string) error {\n\treturn t.Cloud.CreateTags(id, tags)\n}\n\nfunc (t *AWSAPITarget) DeleteTags(id string, tags map[string]string) error {\n\treturn t.Cloud.DeleteTags(id, tags)\n}\n\nfunc (t *AWSAPITarget) UpdateTags(id string, tags map[string]string) error {\n\treturn t.Cloud.UpdateTags(id, tags)\n}\n\nfunc (t *AWSAPITarget) AddELBV2Tags(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\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}","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awsup/aws_apitarget.go#L53-L89","documentation":"AWSAPITarget.AddELBV2Tags wraps errors from Cloud.GetELBV2Tags — reading the current tag set of an ELBv2 (ALB/NLB) resource by ARN — with this message during tag reconciliation driven by RenderAWS. It means kOps could not determine actual tags, so it aborts the AddELBV2Tags reconciliation instead of guessing.","triggerScenarios":"RenderAWS calls AddELBV2Tags for a load balancer/listener/target-group ARN and GetELBV2Tags fails (API error, permission, or resource-not-found).","commonSituations":"IAM missing elasticloadbalancing:DescribeTags; ALB/NLB deleted out-of-band between create and tagging; temporary AWS throttling; ARN from another region/account.","solutions":["Grant elasticloadbalancing:DescribeTags to the kOps IAM role","Verify the ELBV2 resource still exists in the expected region (ls or aws elbv2 describe-tags with the ARN)","Re-run kops update cluster after transient throttling clears","Ensure the ARN belongs to the same account/region as the target"],"exampleFix":"// before\nactual, err := t.Cloud.GetELBV2Tags(ResourceArn)\nif err != nil {\n\treturn fmt.Errorf(\"unexpected error fetching tags for resource: %v\", err)\n}\n// after: tolerate NotFound as empty tag set\nif err != nil && awsup.AWSErrorCode(err) != \"ResourceNotFound\" {\n\treturn fmt.Errorf(\"unexpected error fetching tags for resource: %v\", err)\n}","handlingStrategy":"try-catch","validationCode":"if !iamAllows(\"elasticloadbalancing:DescribeTags\") { return errors.New(\"IAM policy missing elasticloadbalancing:DescribeTags\") }\nout, _ := elbv2.DescribeTags(&elbv2.DescribeTagsInput{ResourceArns: []string{arn}})\nif len(out.TagDescriptions) == 0 { return errors.New(\"ELBV2 resource not found: \" + arn) }","typeGuard":null,"tryCatchPattern":"err := target.AddELBV2Tags(arn, expectedTags)\nif err != nil {\n\tvar retryable bool\n\tif aerr, ok := err.(awserr.Error); ok { retryable = aerr.Code() == \"Throttling\" }\n\tif retryable { time.Sleep(backoff); return AddELBV2Tags(arn, expectedTags) }\n\treturn err\n}","preventionTips":["Grant elasticloadbalancing:DescribeTags/AddTags to the kOps IAM role","Don't delete ALBs/NLBs out-of-band during a kOps apply","Watch DescribeTags throttling on large clusters and spread applies","Keep ARNs in one region/account consistent with the kOps target"],"tags":["aws","elbv2","tags"],"backgroundTag":"aws-tag-fetch-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"}