{"record":{"id":"c1a7279eec597b71","repo":"kubernetes/kops","slug":"found-multiple-ports-with-name-s","errorCode":null,"errorMessage":"found multiple ports with name: %s","messagePattern":"found multiple ports with name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/port.go","lineNumber":218,"sourceCode":"\t\tactual.AdditionalSecurityGroups = find.AdditionalSecurityGroups\n\t\tactual.WellKnownServices = find.WellKnownServices\n\t}\n\treturn actual, nil\n}\n\nfunc (s *Port) Find(context *fi.CloudupContext) (*Port, error) {\n\tcloud := context.T.Cloud.(openstack.OpenstackCloud)\n\topt := ports.ListOpts{\n\t\tName: fi.ValueOf(s.Name),\n\t}\n\trs, err := cloud.ListPorts(opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif rs == nil {\n\t\treturn nil, nil\n\t} else if len(rs) != 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple ports with name: %s\", fi.ValueOf(s.Name))\n\t}\n\n\t// sort for consistent comparison\n\tsort.Sort(SecurityGroupsByID(s.SecurityGroups))\n\n\treturn newPortTaskFromCloud(cloud, s.Lifecycle, &rs[0], s)\n}\n\nfunc (s *Port) Run(context *fi.CloudupContext) error {\n\treturn fi.CloudupDefaultDeltaRunMethod(s, context)\n}\n\nfunc (_ *Port) CheckChanges(a, e, changes *Port) error {\n\tif a == nil {\n\t\tif e.Name == nil {\n\t\t\treturn fi.RequiredField(\"Name\")\n\t\t}\n\t\tif e.Network == nil {","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/port.go#L200-L236","documentation":"Port.Find is the cloud-discovery half of the Port task: it looks up an existing Neutron port by name and expects exactly one match. If the Neutron ports list returns more than one port with the requested name, Find refuses to guess and returns this error so reconciliation fails deterministically instead of mutating the wrong port.","triggerScenarios":"Two or more Neutron ports share the same name in the project when the Port task runs Find during cluster reconciliation (listPorts filtered by name returns len(rs) > 1).","commonSituations":"A previous failed/aborted kops run left a duplicate port behind; another tool or user manually created a port with the same name; ports created in a different availability zone reused a clashing name.","solutions":["List Neutron ports in the project (openstack port list --name <name>) and delete the stale duplicate","Re-run kops after only one port with that name remains","If duplicates are from an aborted run, remove all leftover load-balancer/networking resources and re-create","Rename the manually created port so it no longer collides"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"ports, err := cloud.ListPorts(listOpts{Name: portName})\nif err != nil { return err }\nif len(ports) > 1 {\n    return fmt.Errorf(\"found multiple ports with name: %s — delete duplicates first\", portName)\n}","typeGuard":null,"tryCatchPattern":"if err := task.Find(cloud); err != nil {\n    if strings.Contains(err.Error(), \"found multiple ports\") {\n        // remediate: list & delete duplicate ports, then retry\n    }\n}","preventionTips":["Run `openstack port list --name <name>` before kops apply","Clean up leftover resources from aborted runs","Avoid manually creating ports with kops-managed names","Use separate projects per cluster to avoid name collisions"],"tags":["openstack","neutron","port"],"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"}