kubernetes/kops · error

found multiple EventBridge rules with the same name

Error message

found multiple EventBridge rules with the same name

What it means

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.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/eventbridgerule.go:70

func (eb *EventBridgeRule) Find(c *fi.CloudupContext) (*EventBridgeRule, error) {
	cloud := awsup.GetCloud(c)

	if eb.Name == nil {
		return nil, nil
	}

	request := &eventbridge.ListRulesInput{
		NamePrefix: eb.Name,
	}
	response, err := cloud.EventBridge().ListRules(c.Context(), request)
	if err != nil {
		return nil, fmt.Errorf("error listing EventBridge rules: %v", err)
	}
	if response == nil || len(response.Rules) == 0 {
		return nil, nil
	}
	if len(response.Rules) > 1 {
		return nil, fmt.Errorf("found multiple EventBridge rules with the same name")
	}

	rule := response.Rules[0]

	tagResponse, err := cloud.EventBridge().ListTagsForResource(c.Context(), &eventbridge.ListTagsForResourceInput{ResourceARN: rule.Arn})
	if err != nil {
		return nil, fmt.Errorf("error listing tags for EventBridge rule: %v", err)
	}

	actual := &EventBridgeRule{
		ID:           eb.ID,
		Name:         eb.Name,
		Lifecycle:    eb.Lifecycle,
		EventPattern: rule.EventPattern,
		SQSQueue:     eb.SQSQueue,
		Tags:         mapEventBridgeTagsToMap(tagResponse.Tags),
	}
	return actual, nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. 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>
  2. Make rule names unique per cluster (include cluster name in the EventBridgeRule Name in the spec)
  3. If stale rules from removed clusters remain, delete them via `kops delete cluster` leftovers or the console/CLI
  4. Re-run kops update cluster and confirm Find resolves a single rule

Example fix

// before: duplicate rules in same region
aws events list-rules --name-prefix aws-sqs-eventbridge # returns 2 rules
// after: remove the stale one
aws events delete-rule --name aws-sqs-eventbridge-old
Defensive patterns

Strategy: validation

Validate before calling

out, _ := ebClient.ListRules(ctx, &eventbridge.ListRulesInput{NamePrefix: aws.String(ruleName)})
if len(out.Rules) > 1 {
    return fmt.Errorf("resolve %d rules matching prefix %q before updating", len(out.Rules), ruleName)
}

Try / catch

if err != nil && strings.Contains(err.Error(), "found multiple EventBridge rules") {
    // list matching rules, delete the stale one, then retry kops update
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/8ba37c9008c60546. Report an issue: GitHub.