{"record":{"id":"45ae36a41ab0b74b","repo":"kubernetes/kops","slug":"error-creating-subnet-v","errorCode":null,"errorMessage":"error creating subnet: %v","messagePattern":"error creating subnet: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/subnet.go","lineNumber":283,"sourceCode":"\n\tif a == nil {\n\t\tklog.V(2).Infof(\"Creating Subnet with CIDR: %q IPv6CIDR: %q\", fi.ValueOf(e.CIDR), fi.ValueOf(e.IPv6CIDR))\n\n\t\trequest := &ec2.CreateSubnetInput{\n\t\t\tCidrBlock:         e.CIDR,\n\t\t\tIpv6CidrBlock:     e.IPv6CIDR,\n\t\t\tAvailabilityZone:  e.AvailabilityZone,\n\t\t\tVpcId:             e.VPC.ID,\n\t\t\tTagSpecifications: awsup.EC2TagSpecification(ec2types.ResourceTypeSubnet, e.Tags),\n\t\t}\n\n\t\tif e.CIDR == nil {\n\t\t\trequest.Ipv6Native = aws.Bool(true)\n\t\t}\n\n\t\tresponse, err := t.Cloud.EC2().CreateSubnet(ctx, request)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error creating subnet: %v\", err)\n\t\t}\n\n\t\te.ID = response.Subnet.SubnetId\n\t} else {\n\t\tif changes.IPv6CIDR != nil {\n\t\t\trequest := &ec2.AssociateSubnetCidrBlockInput{\n\t\t\t\tIpv6CidrBlock: e.IPv6CIDR,\n\t\t\t\tSubnetId:      e.ID,\n\t\t\t}\n\n\t\t\t_, err := t.Cloud.EC2().AssociateSubnetCidrBlock(ctx, request)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error associating subnet cidr block: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tif a == nil || changes.AssignIPv6AddressOnCreation != nil {","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/subnet.go#L265-L301","documentation":"CreateSubnet failed while creating the subnet — commonly a CIDR collision with another subnet in the VPC, an invalid IPv6 CIDR, or an availability-zone mismatch; the wrapped error is the AWS API response.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/awstasks/subnet.go:283 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the subnet CIDR does not overlap other subnets in the VPC","Check the availability zone is valid for the region","Verify IPv6 CIDR hints are consistent with the VPC's IPv6 block"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}