{"record":{"id":"f78d04a39e0a91d2","repo":"kubernetes/kops","slug":"failed-to-assign-prefix-w","errorCode":null,"errorMessage":"failed to assign prefix: %w","messagePattern":"failed to assign prefix: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/nodeup/nodetasks/prefix.go","lineNumber":103,"sourceCode":"\nfunc (_ *Prefix) RenderLocal(t *local.LocalTarget, a, e, changes *Prefix) error {\n\tctx := context.TODO()\n\tmac, err := getInstanceMetadataFirstValue(ctx, \"mac\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinterfaceId, err := getInstanceMetadataFirstValue(ctx, path.Join(\"network/interfaces/macs/\", mac, \"/interface-id\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresponse, err := t.Cloud.AssignIpv6Addresses(ctx, &ec2.AssignIpv6AddressesInput{\n\t\tIpv6PrefixCount:    new(int32(1)),\n\t\tNetworkInterfaceId: new(interfaceId),\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to assign prefix: %w\", err)\n\t}\n\tklog.V(2).Infof(\"assigned prefix to primary network interface: %q\", response.AssignedIpv6Prefixes[0])\n\n\treturn nil\n}\n\nfunc getInstanceMetadataFirstValue(ctx context.Context, category string) (string, error) {\n\tvalues, err := getInstanceMetadataList(ctx, category)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(values) == 0 {\n\t\treturn \"\", fmt.Errorf(\"failed to get %q from ec2 meta-data: not found\", category)\n\t}\n\n\treturn values[0], nil\n}\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/nodeup/nodetasks/prefix.go#L85-L121","documentation":"RenderLocal calls EC2 AssignIpv6Addresses to delegate an /80 IPv6 prefix to the instance's primary network interface; if the EC2 API call fails, the underlying AWS SDK error is wrapped with this message. This usually means the ENI is not configured for prefix delegation.","triggerScenarios":"Calling AssignIpv6Addresses with Ipv6PrefixCount=1 on a network interface whose subnet lacks an associated IPv6 CIDR, has no prefix delegation enabled, or where the API returns auth/throttling/permission errors.","commonSituations":"Subnet created without an IPv6 CIDR; instance metadata/IMDS unavailable so the wrong interface ID; IAM role missing ec2:AssignIpv6Addresses permission; EC2 API throttling during cluster bring-up.","solutions":["Verify the subnet has an IPv6 CIDR associated (`aws ec2 describe-subnets`) and that prefix delegation is supported in that AZ.","Ensure the instance IAM role permits ec2:AssignIpv6Addresses on the ENI.","Check the wrapped SDK error for throttling (RequestLimitExceeded) and retry with backoff.","Confirm the ENI is the instance's primary interface with device index 0 and IPv6 enabled."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-checks\nsubnets must have associated IPv6 CIDR\ninstance IAM role must allow ec2:AssignIpv6Addresses","typeGuard":null,"tryCatchPattern":"var ae smithy.APIError\nif errors.As(err, &ae) {\n    if ae.ErrorCode() == \"RequestLimitExceeded\" || ae.Fault() == smithy.FaultServer {\n        // retry with exponential backoff\n    }\n}","preventionTips":["Associate an IPv6 CIDR with the subnet before enabling prefix delegation","Grant ec2:AssignIpv6Addresses to the node instance role","Verify ENI is the primary interface with IPv6 enabled"],"tags":["aws","ec2","ipv6","networking"],"backgroundTag":"ec2-api-call-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"}