{"record":{"id":"a47c7bf1fba01137","repo":"kubernetes/kops","slug":"error-listing-eventbridge-targets-v","errorCode":null,"errorMessage":"error listing EventBridge targets: %v","messagePattern":"error listing EventBridge targets: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/eventbridgetarget.go","lineNumber":72,"sourceCode":"\t\treturn nil, nil\n\t}\n\n\t// find the rule the target is attached to\n\trule, err := eb.Rule.Find(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif rule == nil {\n\t\treturn nil, nil\n\t}\n\n\trequest := &eventbridge.ListTargetsByRuleInput{\n\t\tRule: eb.Rule.Name,\n\t}\n\n\tresponse, err := cloud.EventBridge().ListTargetsByRule(c.Context(), request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing EventBridge targets: %v\", err)\n\t}\n\tif response == nil || len(response.Targets) == 0 {\n\t\treturn nil, nil\n\t}\n\tfor _, target := range response.Targets {\n\t\tif fi.ValueOf(target.Arn) == fi.ValueOf(eb.SQSQueue.ARN) {\n\t\t\tactual := &EventBridgeTarget{\n\t\t\t\tID:        target.Id,\n\t\t\t\tName:      eb.Name,\n\t\t\t\tLifecycle: eb.Lifecycle,\n\t\t\t\tRule:      eb.Rule,\n\t\t\t\tSQSQueue:  eb.SQSQueue,\n\t\t\t}\n\t\t\treturn actual, nil\n\t\t}\n\t}\n\n\treturn nil, nil","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/eventbridgetarget.go#L54-L90","documentation":"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.","triggerScenarios":"ListTargetsByRule returns an error: the referenced rule does not exist (ResourceNotFoundException), eventbridge:ListTargetsByRule denied, throttling, or pagination limits hit (>100 targets requires Limit/pagination).","commonSituations":"The EventBridgeRule task failed to create, so targets are listed against a nonexistent rule; IAM policy missing list permission; transient throttling during apply.","solutions":["Ensure the EventBridgeRule task is applied before EventBridgeTarget (correct dependency order in the task map).","Grant eventbridge:ListTargetsByRule to the kOps IAM role.","Re-run to clear transient throttling; verify the rule name matches exactly (case-sensitive)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the rule exists before listing targets\naws events describe-rule --name <rule-name> || echo \"rule missing\"","typeGuard":null,"tryCatchPattern":"// Treat ResourceNotFoundException as 'rule not yet created' and ensure the EventBridgeRule task runs first\nif awsup.AWSErrorCode(err) == \"ResourceNotFoundException\" { return nil, nil }","preventionTips":["Keep EventBridgeRule and EventBridgeTarget in the same apply","Match rule names exactly (case-sensitive)","Grant eventbridge:ListTargetsByRule in IAM"],"tags":["aws","eventbridge","targets","iam"],"backgroundTag":"aws-api-permission-denied","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"}