kubernetes/kops · error

error listing EventBridge targets: %v

Error message

error listing EventBridge targets: %v

What it means

EventBridgeTarget.Find calls ListTargetsByRule for the rule named by eb.Rule.Name and wraps any API error with this message. It surfaces when reading the target list associated with an existing EventBridge rule fails.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/eventbridgetarget.go:72

		return nil, nil
	}

	// find the rule the target is attached to
	rule, err := eb.Rule.Find(c)
	if err != nil {
		return nil, err
	}
	if rule == nil {
		return nil, nil
	}

	request := &eventbridge.ListTargetsByRuleInput{
		Rule: eb.Rule.Name,
	}

	response, err := cloud.EventBridge().ListTargetsByRule(c.Context(), request)
	if err != nil {
		return nil, fmt.Errorf("error listing EventBridge targets: %v", err)
	}
	if response == nil || len(response.Targets) == 0 {
		return nil, nil
	}
	for _, target := range response.Targets {
		if fi.ValueOf(target.Arn) == fi.ValueOf(eb.SQSQueue.ARN) {
			actual := &EventBridgeTarget{
				ID:        target.Id,
				Name:      eb.Name,
				Lifecycle: eb.Lifecycle,
				Rule:      eb.Rule,
				SQSQueue:  eb.SQSQueue,
			}
			return actual, nil
		}
	}

	return nil, nil

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure the EventBridgeRule task is applied before EventBridgeTarget (correct dependency order in the task map).
  2. Grant eventbridge:ListTargetsByRule to the kOps IAM role.
  3. Re-run to clear transient throttling; verify the rule name matches exactly (case-sensitive).
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the rule exists before listing targets
aws events describe-rule --name <rule-name> || echo "rule missing"

Try / catch

// Treat ResourceNotFoundException as 'rule not yet created' and ensure the EventBridgeRule task runs first
if awsup.AWSErrorCode(err) == "ResourceNotFoundException" { return nil, nil }

Prevention

When it happens

Trigger: ListTargetsByRule returns an error: the referenced rule does not exist (ResourceNotFoundException), eventbridge:ListTargetsByRule denied, throttling, or pagination limits hit (>100 targets requires Limit/pagination).

Common situations: The EventBridgeRule task failed to create, so targets are listed against a nonexistent rule; IAM policy missing list permission; transient throttling during apply.

Related errors


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