{"record":{"id":"8ba37c9008c60546","repo":"kubernetes/kops","slug":"found-multiple-eventbridge-rules-with-the-same-nam-8ba37c","errorCode":null,"errorMessage":"found multiple EventBridge rules with the same name","messagePattern":"found multiple EventBridge rules with the same name","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/eventbridgerule.go","lineNumber":70,"sourceCode":"func (eb *EventBridgeRule) Find(c *fi.CloudupContext) (*EventBridgeRule, error) {\n\tcloud := awsup.GetCloud(c)\n\n\tif eb.Name == nil {\n\t\treturn nil, nil\n\t}\n\n\trequest := &eventbridge.ListRulesInput{\n\t\tNamePrefix: eb.Name,\n\t}\n\tresponse, err := cloud.EventBridge().ListRules(c.Context(), request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing EventBridge rules: %v\", err)\n\t}\n\tif response == nil || len(response.Rules) == 0 {\n\t\treturn nil, nil\n\t}\n\tif len(response.Rules) > 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple EventBridge rules with the same name\")\n\t}\n\n\trule := response.Rules[0]\n\n\ttagResponse, err := cloud.EventBridge().ListTagsForResource(c.Context(), &eventbridge.ListTagsForResourceInput{ResourceARN: rule.Arn})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing tags for EventBridge rule: %v\", err)\n\t}\n\n\tactual := &EventBridgeRule{\n\t\tID:           eb.ID,\n\t\tName:         eb.Name,\n\t\tLifecycle:    eb.Lifecycle,\n\t\tEventPattern: rule.EventPattern,\n\t\tSQSQueue:     eb.SQSQueue,\n\t\tTags:         mapEventBridgeTagsToMap(tagResponse.Tags),\n\t}\n\treturn actual, nil","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/eventbridgerule.go#L52-L88","documentation":"If ListRules(NamePrefix=eb.Name) returns more than one rule, EventBridgeRule.Find throws 'found multiple EventBridge rules with the same name'. kOps cannot decide which existing rule corresponds to the task, since CompareWithID is the rule Name, so matching must be unique.","triggerScenarios":"More than one EventBridge rule in the region has a name starting with the task's Name prefix — e.g. rules from multiple clusters in one region with overlapping name prefixes, or manually created rules sharing the prefix.","commonSituations":"Running several kOps clusters in the same AWS region where EventBridge rule names aren't cluster-suffixed; pre-existing manually created EventBridge rules with similar names; renamed clusters leaving old rules behind.","solutions":["Delete or rename the conflicting rules so only one matches the prefix: aws events list-rules --name-prefix <name>, then aws events delete-rule --name <conflict>","Make rule names unique per cluster (include cluster name in the EventBridgeRule Name in the spec)","If stale rules from removed clusters remain, delete them via `kops delete cluster` leftovers or the console/CLI","Re-run kops update cluster and confirm Find resolves a single rule"],"exampleFix":"// before: duplicate rules in same region\naws events list-rules --name-prefix aws-sqs-eventbridge # returns 2 rules\n// after: remove the stale one\naws events delete-rule --name aws-sqs-eventbridge-old","handlingStrategy":"validation","validationCode":"out, _ := ebClient.ListRules(ctx, &eventbridge.ListRulesInput{NamePrefix: aws.String(ruleName)})\nif len(out.Rules) > 1 {\n    return fmt.Errorf(\"resolve %d rules matching prefix %q before updating\", len(out.Rules), ruleName)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"found multiple EventBridge rules\") {\n    // list matching rules, delete the stale one, then retry kops update\n}","preventionTips":["Namespace rule names with the cluster name to avoid prefix collisions","Delete rules of removed clusters (kops delete cluster)","Audit aws events list-rules in shared regions for name collisions","Avoid manually creating rules that share kOps task name prefixes"],"tags":["aws","eventbridge","ambiguous-state","naming"],"backgroundTag":"ambiguous-resource-lookup","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"}