{"record":{"id":"d81f8a2808664c14","repo":"kubernetes/kops","slug":"found-multiple-monitors-with-name-s","errorCode":null,"errorMessage":"found multiple monitors with name: %s","messagePattern":"found multiple monitors with name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/poolmonitor.go","lineNumber":68,"sourceCode":"\treturn p.ID\n}\n\nfunc (p *PoolMonitor) Find(context *fi.CloudupContext) (*PoolMonitor, error) {\n\tcloud := context.T.Cloud.(openstack.OpenstackCloud)\n\n\topt := monitors.ListOpts{\n\t\tName:   fi.ValueOf(p.Name),\n\t\tPoolID: fi.ValueOf(p.Pool.ID),\n\t}\n\n\trs, err := cloud.ListMonitors(opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(rs) == 0 {\n\t\treturn nil, nil\n\t} else if len(rs) != 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple monitors with name: %s\", fi.ValueOf(p.Name))\n\t}\n\tfound := rs[0]\n\tactual := &PoolMonitor{\n\t\tID:        new(found.ID),\n\t\tName:      new(found.Name),\n\t\tPool:      p.Pool,\n\t\tLifecycle: p.Lifecycle,\n\t}\n\tp.ID = actual.ID\n\treturn actual, nil\n}\n\nfunc (p *PoolMonitor) Run(context *fi.CloudupContext) error {\n\treturn fi.CloudupDefaultDeltaRunMethod(p, context)\n}\n\nfunc (_ *PoolMonitor) CheckChanges(a, e, changes *PoolMonitor) error {\n\tif a == nil {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/poolmonitor.go#L50-L86","documentation":"PoolMonitor.Find lists Octavia health monitors for the referenced pool and requires at most one match. When more than one monitor with the same name is found, kOps cannot determine which is the managed one and returns this error instead of guessing.","triggerScenarios":"Listing monitors for the pool returns len(rs) != 1 with >1 result: duplicate health monitors were created on the pool by repeated manual creation or overlapping kops runs against the same project, all sharing the pool monitor's name.","commonSituations":"An earlier aborted update left a monitor behind and a retry created another; an operator manually added a monitor with the same name for testing; two clusters in one project producing identically named monitors on shared pools.","solutions":["List monitors (`openstack loadbalancer healthmonitor list`) and delete all but one with that name","Keep one OpenStack project per cluster to avoid name collisions between clusters","Re-run `kops update cluster` after cleanup so Find matches exactly one monitor","Avoid manually creating monitors with names that kops manages"],"exampleFix":"// before: two monitors named 'api-monitor' on the pool\nopenstack loadbalancer healthmonitor delete <duplicate-id>\n// after: single monitor remains and reconcile proceeds","handlingStrategy":"validation","validationCode":"// detect duplicate monitors before reconcile\ncmd := exec.Command(\"openstack\", \"loadbalancer\", \"healthmonitor\", \"list\")\nout, _ := cmd.Output()\nif bytes.Count(out, []byte(monitorName)) > 1 {\n\treturn fmt.Errorf(\"duplicate monitor %s; remove extras\", monitorName)\n}","typeGuard":"func uniqueMonitors(rs []monitors.Monitor) (*monitors.Monitor, error) {\n\tif len(rs) == 0 { return nil, nil }\n\tif len(rs) == 1 { return &rs[0], nil }\n\treturn nil, fmt.Errorf(\"found %d monitors with same name\", len(rs))\n}","tryCatchPattern":"actual, err := task.Find(ctx)\nif err != nil && strings.Contains(err.Error(), \"found multiple monitors\") {\n\t// list monitors, delete duplicates, then retry reconcile\n}","preventionTips":["Never hand-create health monitors with kops-managed names","Use a dedicated project per cluster to prevent shared-name collisions","Clean up leftovers from aborted updates before retrying"],"tags":["openstack","octavia","health-monitor","duplicate-resource"],"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-12T12:17:11.808Z"}