{"record":{"id":"704fb7d5d2c7d40f","repo":"kubernetes/kops","slug":"found-multiple-akamai-linode-vpcs-named-q","errorCode":null,"errorMessage":"found multiple Akamai (Linode) VPCs named %q","messagePattern":"found multiple Akamai \\(Linode\\) VPCs named %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/linodetasks/vpc.go","lineNumber":73,"sourceCode":"\t}\n\n\tvpcs, err := cloud.Client().ListVPCs(c.Context(), listOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing Akamai (Linode) VPCs: %w\", err)\n\t}\n\n\tvar found *linodego.VPC\n\tname := fi.ValueOf(v.Name)\n\tfor i := range vpcs {\n\t\tcandidate := &vpcs[i]\n\t\tif candidate.Label != name {\n\t\t\tcontinue\n\t\t}\n\t\tif v.Region != nil && candidate.Region != fi.ValueOf(v.Region) {\n\t\t\tcontinue\n\t\t}\n\t\tif found != nil {\n\t\t\treturn nil, fmt.Errorf(\"found multiple Akamai (Linode) VPCs named %q\", name)\n\t\t}\n\t\tfound = candidate\n\t}\n\n\tif found == nil {\n\t\treturn nil, nil\n\t}\n\n\tactual := &VPC{\n\t\tName:        new(found.Label),\n\t\tID:          new(found.ID),\n\t\tLifecycle:   v.Lifecycle,\n\t\tDescription: new(found.Description),\n\t\tRegion:      new(found.Region),\n\t}\n\tv.ID = actual.ID\n\n\treturn actual, nil","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/linodetasks/vpc.go#L55-L91","documentation":"This is a kops-side ambiguity error, not a Linode API error: Find() iterated the VPC list and matched more than one VPC with the same label (and region, when specified). Because the task matches VPCs by Name/label, duplicates make it impossible to determine which VPC the cluster spec refers to, so Find() aborts instead of guessing.","triggerScenarios":"Two or more Linode VPCs in the account share the same label that equals fi.ValueOf(v.Name) and, if v.Region is set, live in the same region - e.g. leftover VPCs from a previous abandoned cluster, a manually created VPC colliding with a kops-managed one, or a case/normalization mismatch that bypassed the label filter.","commonSituations":"Re-running cluster creation after a failed cleanup left orphaned VPCs; a developer manually created a VPC with the same label as the one in the cluster spec; copying a cluster spec to a new cluster in the same account/region without renaming the VPC.","solutions":["List VPCs in the Linode console/API (linode-cli vpcs list), identify the duplicate, and delete the stale/unmanaged one","Rename the leftover VPC's label so only the intended one matches the cluster spec's VPC name","If the wrong VPC should be adopted, set the ID in the task/spec so matching is unambiguous","Ensure each cluster spec uses a unique VPC name within the account and region"],"exampleFix":"// before: two VPCs both labeled \"my-cluster-vpc\"; delete the orphan via CLI\n$ linode-cli vpcs list   # note duplicate IDs\n$ linode-cli vpcs delete 12345\n// after: only one VPC matches; kops Find() succeeds","handlingStrategy":"validation","validationCode":"// Guard before running the update: ensure exactly one VPC matches\nfunc ensureUniqueVPC(ctx context.Context, client *linodego.Client, name, region string) error {\n    vpcs, err := client.ListVPCs(ctx, &linodego.ListOptions{Filter: \"{\\\"label\\\": \\\"\" + name + \"\\\"}\"})\n    if err != nil {\n        return err\n    }\n    n := 0\n    for _, v := range vpcs {\n        if region == \"\" || v.Region == region {\n            n++\n        }\n    }\n    if n > 1 {\n        return fmt.Errorf(\"%d VPCs named %q in region %q; delete or rename duplicates\", n, name, region)\n    }\n    return nil\n}","typeGuard":"func isAmbiguousResourceError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"found multiple Akamai (Linode) VPCs\")\n}","tryCatchPattern":"if err := run(); err != nil {\n    if isAmbiguousResourceError(err) {\n        // stop automation; require manual dedup - do not auto-delete\n        return fmt.Errorf(\"manual cleanup required: %w\", err)\n    }\n    return err\n}","preventionTips":["Use globally unique VPC names per account/region in every cluster spec","Clean up orphaned VPCs after failed or abandoned cluster deletes","Never hand-create VPCs with labels matching kops cluster specs","Rename (not copy) VPC names when cloning cluster specs","Audit `linode-cli vpcs list` before running updates against an account with multiple clusters"],"tags":["linode","vpc","duplicate","ambiguity","kops"],"backgroundTag":"duplicate-resource-name","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"}