{"record":{"id":"3dcbca01e296081e","repo":"kubernetes/kops","slug":"vpc-q-not-found-3dcbca","errorCode":null,"errorMessage":"VPC %q not found","messagePattern":"VPC %q not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/subnets.go","lineNumber":74,"sourceCode":"\t\t\t\tneedZones = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif allSubnetsHaveCIDRs(c) && !needZones {\n\t\tklog.V(4).Infof(\"All subnets have CIDRs; skipping assignment logic\")\n\t\treturn nil\n\t}\n\n\tif c.Spec.Networking.NetworkID != \"\" {\n\n\t\tvpcInfo, err := cloud.FindVPCInfo(c.Spec.Networking.NetworkID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif vpcInfo == nil {\n\t\t\treturn fmt.Errorf(\"VPC %q not found\", c.Spec.Networking.NetworkID)\n\t\t}\n\n\t\tsubnetByID := make(map[string]*fi.SubnetInfo)\n\t\tfor _, subnetInfo := range vpcInfo.Subnets {\n\t\t\tsubnetByID[subnetInfo.ID] = subnetInfo\n\t\t}\n\t\tfor i := range c.Spec.Networking.Subnets {\n\t\t\tsubnet := &c.Spec.Networking.Subnets[i]\n\t\t\tif subnet.ID != \"\" {\n\t\t\t\tcloudSubnet := subnetByID[subnet.ID]\n\t\t\t\tif cloudSubnet == nil {\n\t\t\t\t\treturn fmt.Errorf(\"Subnet %q not found in VPC %q\", subnet.ID, c.Spec.Networking.NetworkID)\n\t\t\t\t}\n\t\t\t\tif subnet.CIDR == \"\" {\n\t\t\t\t\tsubnet.CIDR = cloudSubnet.CIDR\n\t\t\t\t\t// IPv6-only private subnets do not have an IPv4 CIDR\n\t\t\t\t\tif subnet.CIDR == \"\" && (subnet.IPv6CIDR == \"\" || subnet.Type != kops.SubnetTypePrivate) {\n\t\t\t\t\t\treturn fmt.Errorf(\"Subnet %q did not have CIDR\", subnet.ID)","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/subnets.go#L56-L92","documentation":"During cluster-up subnet/CIDR assignment, kOps was asked to look up the VPC with ID `spec.networking.networkID` but `cloud.FindVPCInfo` returned nil — the VPC does not exist (or is not visible to the credentials in use). kOps refuses to proceed because it cannot resolve subnets or CIDRs for a nonexistent network.","triggerScenarios":"`kops create cluster --vpc=vpc-xxxx` (or cluster spec networking.networkID) referencing a VPC ID that is wrong, belongs to a different region/account, or the cloud credentials lack permission to describe it.","commonSituations":"Typo in the VPC ID; using shared-VPC clusters with credentials that cannot see the VPC; VPC deleted after the cluster spec was written; running in the wrong region.","solutions":["Verify the VPC ID exists: `aws ec2 describe-vpcs --vpc-ids vpc-xxxx` in the same region/account as the cluster.","Correct `spec.networking.networkID` (or the `--vpc` flag) in the cluster spec, then `kops update cluster`.","Check the cloud credentials can `ec2:DescribeVpcs` on that VPC (shared VPC requires cross-account access)."],"exampleFix":"// before (cluster.yaml)\nnetworking:\n  networkID: vpc-0123456789deadbeef  # deleted\n// after\nnetworking:\n  networkID: vpc-0abcdef1234567890","handlingStrategy":"validation","validationCode":"out, err := exec.Command(\"aws\", \"ec2\", \"describe-vpcs\", \"--vpc-ids\", vpcID, \"--region\", region).Output()\nif err != nil { return fmt.Errorf(\"VPC %s not visible in region %s: %w\", vpcID, region, err) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify VPC IDs with `aws ec2 describe-vpcs` in the target region/account before `kops create cluster --vpc`.","Ensure kOps credentials can ec2:DescribeVpcs on shared VPCs.","Keep cluster spec VPC references in sync with IaC that may delete VPCs."],"tags":["vpc","aws","networking","cluster-provisioning"],"backgroundTag":"vpc-not-found","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"}