{"record":{"id":"0e4da0004ad4b30b","repo":"kubernetes/kops","slug":"error-listing-vpcs-v","errorCode":null,"errorMessage":"error listing VPCs: %v","messagePattern":"error listing VPCs: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/vpc.go","lineNumber":87,"sourceCode":"\t}\n\top.Dump.VPC = vpc\n\n\treturn nil\n}\n\nfunc DescribeVPC(cloud fi.Cloud, clusterName string) (*ec2types.Vpc, error) {\n\tctx := context.TODO()\n\tc := cloud.(awsup.AWSCloud)\n\n\tvpcs := make(map[string]*ec2types.Vpc)\n\tklog.V(2).Info(\"Listing EC2 VPC\")\n\tfor _, filters := range buildEC2FiltersForCluster(clusterName) {\n\t\trequest := &ec2.DescribeVpcsInput{\n\t\t\tFilters: filters,\n\t\t}\n\t\tresponse, err := c.EC2().DescribeVpcs(ctx, request)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error listing VPCs: %v\", err)\n\t\t}\n\n\t\tfor _, vpc := range response.Vpcs {\n\t\t\tvpcs[aws.ToString(vpc.VpcId)] = &vpc\n\t\t}\n\t}\n\n\tswitch len(vpcs) {\n\tcase 0:\n\t\treturn nil, nil\n\tcase 1:\n\t\treturn vpcs[slices.Collect(maps.Keys(vpcs))[0]], nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"found multiple VPCs for cluster %q: %v\", clusterName, slices.Collect(maps.Keys(vpcs)))\n\t}\n}\n\nfunc ListVPCs(cloud fi.Cloud, clusterName string) ([]*resources.Resource, error) {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/vpc.go#L69-L105","documentation":"DescribeVPC wraps ec2 DescribeVpcs failure while discovering the cluster's VPC by the cluster's filter tags. It fires when the EC2 API call errors (credentials, throttling, region mismatch); the per-filter loop aborts on the first failing query.","triggerScenarios":"Thrown at pkg/resources/aws/vpc.go:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check EC2 credentials and ec2:DescribeVpcs permission","Retry after throttling or transient network errors","Verify the region matches where the cluster's VPC lives"],"exampleFix":null,"handlingStrategy":"retry","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"}