{"record":{"id":"3f00496317048ad3","repo":"kubernetes/kops","slug":"found-multiple-networks-with-name-s","errorCode":null,"errorMessage":"found multiple networks with name: %s","messagePattern":"found multiple networks with name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/network.go","lineNumber":76,"sourceCode":"\nfunc (n *Network) Find(context *fi.CloudupContext) (*Network, error) {\n\tif n.Name == nil && n.ID == nil {\n\t\treturn nil, nil\n\t}\n\n\tcloud := context.T.Cloud.(openstack.OpenstackCloud)\n\topt := networks.ListOpts{\n\t\tID:   fi.ValueOf(n.ID),\n\t\tName: fi.ValueOf(n.Name),\n\t}\n\tns, err := cloud.ListNetworks(opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ns == nil {\n\t\treturn nil, nil\n\t} else if len(ns) != 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple networks with name: %s\", fi.ValueOf(n.Name))\n\t}\n\tv := ns[0]\n\tactual, err := NewNetworkTaskFromCloud(cloud, n.Lifecycle, &v, n.Tag)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create new Network object: %v\", err)\n\t}\n\tn.ID = actual.ID\n\treturn actual, nil\n}\n\nfunc (c *Network) Run(context *fi.CloudupContext) error {\n\treturn fi.CloudupDefaultDeltaRunMethod(c, context)\n}\n\nfunc (_ *Network) CheckChanges(a, e, changes *Network) error {\n\tif a == nil {\n\t\tif e.Name == nil {\n\t\t\treturn fi.RequiredField(\"Name\")","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/network.go#L58-L94","documentation":"Network.Find lists Neutron networks by Name/ID and requires exactly one match; when ListNetworks returns more than one network it returns this error rather than picking arbitrarily. It prevents kOps from reconciling the wrong network for the cluster.","triggerScenarios":"Find is called with only the network name set (n.ID nil) and the project contains two or more networks with that name — e.g. networks in different regions sharing a name, or duplicates created across tenants the token can see.","commonSituations":"Reusing a cluster/network name after incomplete teardown; operator manually created a second network with the same name; per-AZ duplicated networks from other tooling; searching without tenant scoping.","solutions":["List matches: openstack network list --name <name>, and delete the stale/duplicate network if it is not in use.","Pin the network ID in the cluster spec (or kops state) so Find filters by unique ID instead of name.","Rename the non-managed network so names are unique within the project.","If the duplicates belong to another project, fix credentials/scoping so listing only sees the intended tenant's networks."],"exampleFix":"// before: spec resolves network by name only\nnetwork: mycluster.k8s.local  # matches 2 networks\n// after: delete the orphan\n$ openstack network delete <stale-network-id>\n$ kops update cluster --name mycluster --yes","handlingStrategy":"validation","validationCode":"nets := neutronNetworkList(name)\nif len(nets) > 1 {\n\treturn fmt.Errorf(\"%d networks named %q exist (%v); resolve duplicates or specify network ID\", len(nets), name, netIDs(nets))\n}","typeGuard":null,"tryCatchPattern":"if err := kopsUpdate(); err != nil {\n\tif strings.Contains(err.Error(), \"found multiple networks with name\") {\n\t\treturn resolveDuplicateNetworks() // delete orphan or pin ID in spec, then retry\n\t}\n\treturn err\n}","preventionTips":["Use unique network names per project, or pass the network ID in the cluster spec.","Remove leftover networks after aborted cluster deletions.","Scope credentials to a single tenant so listing only sees intended networks."],"tags":["openstack","neutron","network","ambiguous-state"],"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"}