{"record":{"id":"7c5e1b089a5d9191","repo":"kubernetes/kops","slug":"found-multiple-addresses-matching-q","errorCode":null,"errorMessage":"found multiple Addresses matching %q","messagePattern":"found multiple Addresses matching %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/address.go","lineNumber":89,"sourceCode":"\t\treturn nil, fmt.Errorf(\"error listing IP Addresses: %v\", err)\n\t}\n\n\tvar matches []*compute.Address\n\tfor _, addr := range addrs {\n\t\tif subnet != \"\" && addr.Subnetwork != subnet {\n\t\t\tcontinue\n\t\t}\n\t\tif addr.Address == ip {\n\t\t\tmatches = append(matches, addr)\n\t\t}\n\t}\n\n\tif len(matches) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(matches) > 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple Addresses matching %q\", ip)\n\t}\n\n\taddr := matches[0]\n\n\tactual := &Address{}\n\tactual.IPAddress = &addr.Address\n\tactual.IPAddressType = &addr.AddressType\n\tactual.Purpose = &addr.Purpose\n\tactual.Name = &addr.Name\n\tif addr.Subnetwork != \"\" {\n\t\tactual.Subnetwork = &Subnet{\n\t\t\tName: new(lastComponent(addr.Subnetwork)),\n\t\t}\n\t}\n\n\treturn actual, nil\n}\n","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/address.go#L71-L107","documentation":"After filtering GCE addresses by the target IP, findAddressByIP found more than one static address matching the same IP within the project/region (subnet filtering was optional). Because a static IP resource must map to exactly one Address task, kOps refuses to guess and aborts. This is an ambiguous-state protection, not an API failure.","triggerScenarios":"findAddressByIP (called by Find) collects addresses from ListWithFilter, applies optional subnet filtering, and matches on the IP; len(matches) > 1 means two or more GCE Address resources (possibly in different subnets) resolve to the same external/internal IP in the region.","commonSituations":"Duplicate address resources left behind by earlier failed kops runs, addresses created manually in GCP console colliding with kops-managed ones, or regional addresses in different subnets holding the same reserved IP name set.","solutions":["List addresses with `gcloud compute addresses list --filter=\"address=<ip>\" --project=<project>` and identify the duplicates.","Delete the stale/duplicate address resource: `gcloud compute addresses delete <name> --region=<region>` (keep the one you intend kops to manage).","If duplicates are in different subnets and both are intentional, set the subnet field for the task/spec so the subnet filter disambiguates.","Re-run `kops update cluster` so Find resolves a single address."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"out, _ := exec.Command(\"gcloud\", \"compute\", \"addresses\", \"list\",\n    \"--project\", project, \"--filter\", \"address=\"+ip, \"--format\", \"value(name)\").Output()\nnames := strings.Fields(string(out))\nif len(names) > 1 {\n    return fmt.Errorf(\"duplicate GCE addresses for IP %s: %v\", ip, names)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Before apply, run `gcloud compute addresses list --filter=\"address=<ip>\"` and delete stale duplicates.","Let kops manage all static IPs in the project; avoid hand-creating addresses in the console.","Use distinct subnets/IPs per address task, or set the subnet field so lookups disambiguate.","Clean up address resources from aborted kops runs instead of re-creating them manually."],"tags":["gce","static-ip","duplicate-resources","networking"],"backgroundTag":"ambiguous-resource-state","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"}