{"record":{"id":"a2c3cddb8ad19e5d","repo":"kubernetes/kops","slug":"error-deleting-vpc-q-v","errorCode":null,"errorMessage":"error deleting VPC %q: %v","messagePattern":"error deleting VPC %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/aws/vpc.go","lineNumber":54,"sourceCode":"\tc := cloud.(awsup.AWSCloud)\n\n\tid := r.ID\n\n\tklog.V(2).Infof(\"Deleting EC2 VPC %q\", id)\n\trequest := &ec2.DeleteVpcInput{\n\t\tVpcId: &id,\n\t}\n\t_, err := c.EC2().DeleteVpc(ctx, request)\n\tif err != nil {\n\t\tif awsup.AWSErrorCode(err) == \"InvalidVpcID.NotFound\" {\n\t\t\t// Concurrently deleted\n\t\t\treturn nil\n\t\t}\n\n\t\tif IsDependencyViolation(err) {\n\t\t\treturn err\n\t\t}\n\t\treturn fmt.Errorf(\"error deleting VPC %q: %v\", id, err)\n\t}\n\treturn nil\n}\n\nfunc DumpVPC(op *resources.DumpOperation, r *resources.Resource) error {\n\tdata := make(map[string]interface{})\n\tdata[\"id\"] = r.ID\n\tdata[\"type\"] = ec2types.ResourceTypeVpc\n\tdata[\"raw\"] = r.Obj\n\top.Dump.Resources = append(op.Dump.Resources, data)\n\n\tec2VPC := r.Obj.(*ec2types.Vpc)\n\tvpc := &resources.VPC{\n\t\tID: aws.ToString(ec2VPC.VpcId),\n\t}\n\top.Dump.VPC = vpc\n\n\treturn nil","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/aws/vpc.go#L36-L72","documentation":"Fires in DeleteVPC when ec2.DeleteVpc fails with an error that is neither InvalidVpcID.NotFound (treated as concurrently deleted) nor a dependency violation (which is returned for retry) — an unexpected EC2 API failure deleting the VPC.","triggerScenarios":"Thrown at pkg/resources/aws/vpc.go:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check ec2:DeleteVpc permission","If it's a dependency violation, delete remaining subnets/gateways/security groups first and retry","Verify the VPC ID exists in the target region/account"],"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"}