kubernetes/kops · error

found multiple DhcpOptions with name: %s

Error message

found multiple DhcpOptions with name: %s

What it means

Thrown when DescribeDhcpOptions returns more than one DHCP options set matching the task's name. Find expects a unique match for the given name tag and fails rather than reconciling an ambiguous resource.

Source

Thrown at upup/pkg/fi/cloudup/awstasks/dhcp_options.go:76

	request := &ec2.DescribeDhcpOptionsInput{}
	if e.ID != nil {
		request.DhcpOptionsIds = []string{aws.ToString(e.ID)}
	} else {
		request.Filters = cloud.BuildFilters(e.Name)
	}

	response, err := cloud.EC2().DescribeDhcpOptions(c.Context(), request)
	if err != nil {
		return nil, fmt.Errorf("error listing DHCPOptions: %v", err)
	}

	if response == nil || len(response.DhcpOptions) == 0 {
		return nil, nil
	}

	if len(response.DhcpOptions) != 1 {
		return nil, fmt.Errorf("found multiple DhcpOptions with name: %s", *e.Name)
	}
	klog.V(2).Info("found existing DhcpOptions")
	o := response.DhcpOptions[0]
	actual := &DHCPOptions{
		ID:   o.DhcpOptionsId,
		Name: findNameTag(o.Tags),
		Tags: intersectTags(o.Tags, e.Tags),
	}

	for _, s := range o.DhcpConfigurations {
		k := aws.ToString(s.Key)
		v := ""
		for _, av := range s.Values {
			if v != "" {
				v = v + ","
			}
			v = v + *av.Value
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. List options sets: aws ec2 describe-dhcp-options with tag filters to find duplicates
  2. Delete the stale duplicate (aws ec2 delete-dhcp-options) if not attached to a VPC
  3. Attach the correct options set to the VPC or rename the duplicate's Name tag
  4. Ensure cluster names are unique per account/region to prevent collisions

Example fix

// before: duplicate tagged sets
aws ec2 create-dhcp-options --dhcp-configuration ... --tag-specifications 'ResourceType=dhcp-options,Tags=[{Key=Name,Value=mycluster}]'  # second time
// after: remove the stale duplicate
aws ec2 delete-dhcp-options --dhcp-options-id dopt-STALEID
Defensive patterns

Strategy: validation

Validate before calling

count=$(aws ec2 describe-dhcp-options --filters Name=tag:Name,Values=$CLUSTER_NAME --query 'DhcpOptions | length(@)')
[ "$count" -le 1 ] || { echo "Duplicate DHCP options sets found"; exit 1; }

Try / catch

catch (err) {
  if (String(err).startsWith('found multiple DhcpOptions')) {
    // delete/rename stale duplicates then retry apply
  }
  throw err;
}

Prevention

When it happens

Trigger: Two or more DHCP options sets in the VPC region carry the same Name tag value, typically from duplicate applies, out-of-band creation, or clusters created with the same name in the same account.

Common situations: Recreated clusters reusing a name without cleaning old DHCP options sets; manual console/Terraform-managed duplicates; missing region/account isolation in tooling.

Related errors


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