kubernetes/kops · error

found multiple ASG Lifecycle Hooks with the same name

Error message

found multiple ASG Lifecycle Hooks with the same name

What it means

Thrown when DescribeLifecycleHooks returns more than one hook matching the task's single hook name for the ASG. The Find method expects at most one hook per (ASG, hook name) pair and refuses to guess which to reconcile.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/autoscalinglifecyclehook.go:78

	request := &autoscaling.DescribeLifecycleHooksInput{
		AutoScalingGroupName: h.AutoscalingGroup.Name,
		LifecycleHookNames:   []string{aws.ToString(h.GetHookName())},
	}

	response, err := cloud.Autoscaling().DescribeLifecycleHooks(ctx, request)
	if err != nil {
		return nil, fmt.Errorf("error listing ASG Lifecycle Hooks: %v", err)
	}
	if response == nil || len(response.LifecycleHooks) == 0 {
		if !fi.ValueOf(h.Enabled) {
			return h, nil
		}

		return nil, nil
	}
	if len(response.LifecycleHooks) > 1 {
		return nil, fmt.Errorf("found multiple ASG Lifecycle Hooks with the same name")
	}

	hook := response.LifecycleHooks[0]
	actual := &AutoscalingLifecycleHook{
		ID:                  h.Name,
		Name:                h.Name,
		HookName:            h.HookName,
		Lifecycle:           h.Lifecycle,
		AutoscalingGroup:    h.AutoscalingGroup,
		DefaultResult:       hook.DefaultResult,
		HeartbeatTimeout:    hook.HeartbeatTimeout,
		LifecycleTransition: hook.LifecycleTransition,
		Enabled:             new(true),
	}

	return actual, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. List the ASG lifecycle hooks in the AWS console/CLI (aws autoscaling describe-lifecycle-hooks)
  2. Delete the duplicate hook so only one remains with the expected name
  3. Re-run kops apply/update to reconcile cleanly
  4. Audit other IaC tooling managing the same ASG to avoid recreating duplicates

Example fix

// before: duplicates present
aws autoscaling put-lifecycle-hook --lifecycle-hook-name Foo ...
aws autoscaling put-lifecycle-hook --lifecycle-hook-name Foo ...  # duplicate
// after: remove the duplicate
aws autoscaling delete-lifecycle-hook --auto-scaling-group-name myasg --lifecycle-hook-name Foo
Defensive patterns

Strategy: validation

Validate before calling

aws autoscaling describe-lifecycle-hooks --auto-scaling-group-name $ASG \
  --query "LifecycleHooks[?LifecycleHookName=='$HOOK'] | length(@)"
# must output 1 (or 0) before applying

Try / catch

catch (err) {
  if (String(err).includes('found multiple ASG Lifecycle Hooks')) {
    // remediate duplicates out-of-band, then retry
  }
  throw err;
}

Prevention

When it happens

Trigger: More than one lifecycle hook with the same name exists on the same Auto Scaling Group — possible if hooks were created out-of-band (console, Terraform, other tooling) or a prior creation partially duplicated.

Common situations: Manual AWS console edits; duplicate infrastructure applied by two IaC tools; state drift after a failed kOps apply left a stale hook.

Related errors


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