{"record":{"id":"9f0e564bee10807c","repo":"kubernetes/kops","slug":"expecting-subnet-cidr-to-not-be-nil","errorCode":null,"errorMessage":"expecting subnet CIDR to not be <nil>","messagePattern":"expecting subnet CIDR to not be <nil>","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/subnet.go","lineNumber":557,"sourceCode":"\nfunc (d *deleteSubnetIPv6CIDRBlock) TaskName() string {\n\treturn \"SubnetIPv6CIDRBlock\"\n}\n\nfunc (d *deleteSubnetIPv6CIDRBlock) Item() string {\n\treturn fmt.Sprintf(\"%v: ipv6cidr=%v\", *d.vpcID, *d.ipv6CidrBlock)\n}\n\nfunc (d *deleteSubnetIPv6CIDRBlock) DeferDeletion() bool {\n\treturn false // TODO: should we defer this?\n}\n\nfunc calculateSubnetCIDR(vpcCIDR, subnetCIDR *string) (*string, error) {\n\tif vpcCIDR == nil {\n\t\treturn nil, fmt.Errorf(\"expecting VPC CIDR to not be <nil>\")\n\t}\n\tif subnetCIDR == nil {\n\t\treturn nil, fmt.Errorf(\"expecting subnet CIDR to not be <nil>\")\n\t}\n\tif !strings.HasPrefix(aws.ToString(subnetCIDR), \"/\") {\n\t\treturn nil, fmt.Errorf(\"expecting subnet cidr to start with %q: %q\", \"/\", aws.ToString(subnetCIDR))\n\t}\n\n\tnewSize, netNum, err := utils.ParseCIDRNotation(aws.ToString(subnetCIDR))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing CIDR subnet: %v\", err)\n\t}\n\n\tnewCIDR, err := utils.CIDRSubnet(aws.ToString(vpcCIDR), newSize, netNum)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error calculating CIDR subnet: %v\", err)\n\t}\n\n\treturn aws.String(newCIDR), nil\n}\n","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/subnet.go#L539-L575","documentation":"calculateSubnetCIDR was asked to compute a CIDR but the subnet's CIDR hint pointer is nil — the spec is incomplete: a subnet expects a computed CIDR without providing the '/size,netnum' hint.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/awstasks/subnet.go:557 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the subnet's CIDR hint (e.g. '/24,3') or an explicit CIDR in the cluster spec","Re-run `kops update cluster` after fixing the subnet spec"],"exampleFix":null,"handlingStrategy":"validation","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-12T12:17:11.808Z"}