{"record":{"id":"db519d39848c03b7","repo":"kubernetes/kops","slug":"expecting-exactly-1-address-prefix-for-q-found","errorCode":null,"errorMessage":"expecting exactly 1 address prefix for %q, found %d: %+v","messagePattern":"expecting exactly 1 address prefix for %q, found (.+?): %\\+v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azuretasks/virtualnetwork.go","lineNumber":87,"sourceCode":"\t}\n\n\tif found.ID == nil {\n\t\treturn nil, fmt.Errorf(\"found virtual network without ID\")\n\t}\n\tif found.Properties == nil {\n\t\treturn nil, fmt.Errorf(\"found virtual network without properties\")\n\t}\n\tif found.Properties.ProvisioningState != nil && *found.Properties.ProvisioningState == network.ProvisioningStateFailed {\n\t\tklog.Warningf(\"found virtual network %q in failed provisioning state\", *n.Name)\n\t\treturn nil, nil\n\t}\n\tif found.Properties.AddressSpace == nil {\n\t\treturn nil, fmt.Errorf(\"found virtual network without address space\")\n\t}\n\n\taddrPrefixes := found.Properties.AddressSpace.AddressPrefixes\n\tif len(addrPrefixes) != 1 {\n\t\treturn nil, fmt.Errorf(\"expecting exactly 1 address prefix for %q, found %d: %+v\", *n.Name, len(addrPrefixes), addrPrefixes)\n\t}\n\treturn &VirtualNetwork{\n\t\tName:      n.Name,\n\t\tLifecycle: n.Lifecycle,\n\t\tShared:    n.Shared,\n\t\tResourceGroup: &ResourceGroup{\n\t\t\tName: n.ResourceGroup.Name,\n\t\t},\n\t\tCIDR: addrPrefixes[0],\n\t\tTags: found.Tags,\n\t}, nil\n}\n\nfunc (n *VirtualNetwork) Normalize(c *fi.CloudupContext) error {\n\tc.T.Cloud.(azure.AzureCloud).AddClusterTags(n.Tags)\n\treturn nil\n}\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azuretasks/virtualnetwork.go#L69-L105","documentation":"Validation guard in the Azure VNet Find: kOps models a VNet with exactly one address prefix, and the discovered network has a different count (zero or multiple prefixes). Fires when adopting a pre-existing VNet whose CIDR layout does not match kOps' single-CIDR assumption.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/azuretasks/virtualnetwork.go:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a VNet with exactly one address prefix for the cluster","Or let kOps create its own VNet instead of specifying an existing NetworkID","Adjust the VNet address prefixes in Azure before importing"],"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-12T07:17:12.445Z"}