{"record":{"id":"af150e2bc02fee18","repo":"kubernetes/kops","slug":"error-building-cloud-tags-v","errorCode":null,"errorMessage":"error building cloud tags: %v","messagePattern":"error building cloud tags: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/awsmodel/autoscalinggroup.go","lineNumber":204,"sourceCode":"\t\t\trootVolumeEncryption = fi.ValueOf(ig.Spec.RootVolume.Encryption)\n\t\t}\n\n\t\tif fi.ValueOf(ig.Spec.RootVolume.Encryption) && ig.Spec.RootVolume.EncryptionKey != nil {\n\t\t\trootVolumeKmsKey = *ig.Spec.RootVolume.EncryptionKey\n\t\t}\n\t}\n\tif rootVolumeType == \"\" {\n\t\trootVolumeType = DefaultVolumeType\n\t}\n\n\tsecurityGroups, err := b.buildSecurityGroups(c, ig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttags, err := b.CloudTagsForInstanceGroup(ig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error building cloud tags: %v\", err)\n\t}\n\n\tlt := &awstasks.LaunchTemplate{\n\t\tName:                    new(name),\n\t\tLifecycle:               b.Lifecycle,\n\t\tCPUCredits:              new(fi.ValueOf(ig.Spec.CPUCredits)),\n\t\tHTTPPutResponseHopLimit: new(int32(1)),\n\t\tHTTPTokens:              new(ec2types.LaunchTemplateHttpTokensStateRequired),\n\t\tHTTPProtocolIPv6:        new(ec2types.LaunchTemplateInstanceMetadataProtocolIpv6Disabled),\n\t\tIAMInstanceProfile:      link,\n\t\tImageID:                 new(ig.Spec.Image),\n\t\tInstanceMonitoring:      new(false),\n\t\tIPv6AddressCount:        new(int32(0)),\n\t\tRootVolumeIops:          new(int32(0)),\n\t\tRootVolumeSize:          new(int32(rootVolumeSize)),\n\t\tRootVolumeType:          rootVolumeType,\n\t\tRootVolumeEncryption:    new(rootVolumeEncryption),\n\t\tRootVolumeKmsKey:        new(rootVolumeKmsKey),","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/autoscalinggroup.go#L186-L222","documentation":"buildLaunchTemplateTask calls CloudTagsForInstanceGroup to compute the tags applied to the launch template / instances; if that helper returns an error it is wrapped as \"error building cloud tags\" and the launch template task is not created.","triggerScenarios":"`kops update cluster` when tag construction fails — most commonly because a tag key or value contains characters invalid for AWS resource tags or exceeds AWS tag limits (256-char value, 128-char key), or the cluster/spec supplies an unparseable tag.","commonSituations":"Custom tags added via cluster spec (spec.cloudTags or hooks) containing invalid characters or reserved prefixes; overly long cluster names pushing generated tag values over AWS limits; cross-account/tooling injecting malformed tags.","solutions":["Look at the wrapped inner error (%v) for the exact tag that failed validation.","Remove or shorten custom tags in the cluster spec that violate AWS tag rules (key <=128 chars, value <=256 chars, allowed characters).","Avoid reserved prefixes like 'kubernetes.io' or 'k8s.io' in custom tags unless kOps sets them.","Rename/shorten the cluster name if generated tags exceed AWS limits.","Re-run `kops update cluster` after correcting the tags."],"exampleFix":"// before (cluster spec)\ncloudLabels:\n  \"my very/long tag key with*bad chars\": \"x\"\n// after\ncloudLabels:\n  \"team\": \"platform\"","handlingStrategy":"validation","validationCode":"# preflight custom tags against AWS limits before kops update\nfor k in $(kops get cluster -oyaml | yq '.spec.cloudLabels // {} | keys[]'); do\n  [ ${#k} -le 128 ] || { echo \"tag key too long: $k\"; exit 1; }\n  case \"$k\" in kubernetes.io/*|k8s.io/*) echo \"reserved prefix: $k\"; exit 1;; esac\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate custom cloudLabels for AWS tag rules (characters, 128/256 char limits)","Never use reserved prefixes kubernetes.io/ or k8s.io/ in custom tags","Keep cluster and instance-group names short to keep generated tags within limits","Run kops update with --target=terraform as a dry run after changing labels"],"tags":["aws","tags","instance-group","launch-template"],"backgroundTag":"invalid-cloud-tag","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"}