{"record":{"id":"51b1ac0b0e14423d","repo":"kubernetes/kops","slug":"found-multiple-volumes-with-name-s","errorCode":null,"errorMessage":"found multiple Volumes with name: %s","messagePattern":"found multiple Volumes with name: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/ebsvolume.go","lineNumber":76,"sourceCode":"\tctx := c.Context()\n\tcloud := awsup.GetCloud(c)\n\n\tfilters := cloud.BuildFilters(e.Name)\n\trequest := &ec2.DescribeVolumesInput{\n\t\tFilters: filters,\n\t}\n\n\tresponse, err := cloud.EC2().DescribeVolumes(ctx, request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing volumes: %v\", err)\n\t}\n\n\tif response == nil || len(response.Volumes) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(response.Volumes) != 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple Volumes with name: %s\", *e.Name)\n\t}\n\tklog.V(2).Info(\"found existing volume\")\n\tv := response.Volumes[0]\n\tactual := &EBSVolume{\n\t\tID:               v.VolumeId,\n\t\tAvailabilityZone: v.AvailabilityZone,\n\t\tVolumeType:       v.VolumeType,\n\t\tSizeGB:           v.Size,\n\t\tKmsKeyId:         v.KmsKeyId,\n\t\tEncrypted:        v.Encrypted,\n\t\tName:             e.Name,\n\t\tVolumeIops:       v.Iops,\n\t\tVolumeThroughput: v.Throughput,\n\t}\n\n\tactual.Tags = mapEC2TagsToMap(v.Tags)\n\n\t// Avoid spurious changes","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/ebsvolume.go#L58-L94","documentation":"Find() expects the name tag filter to match exactly one EBS volume; if multiple volumes carry the same name tag, kOps cannot determine which one the task manages and aborts rather than guessing. This is an ambiguity guard against operating on the wrong volume.","triggerScenarios":"Two or more EBS volumes in the region share the same value for the kOps name tag (e.g. a volume was duplicated, or the name tag was copied manually or by a snapshot-restore flow).","commonSituations":"Manually copying a volume and its tags; restoring a snapshot into a new volume retaining the name tag; running multiple clusters whose volume name tags collide.","solutions":["Delete or rename the duplicate volume's name tag so only one match remains","Remove the truly redundant volume after verifying data","Make the task's name tag value unique in the cluster spec","Use `aws ec2 describe-volumes --filters Name=tag:Name,Values=<name>` to list the duplicates"],"exampleFix":"// before\naws ec2 create-volume --snapshot-id snap-123 --tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=a.etcd-events.mycluster}]'\n// after\naws ec2 create-volume --snapshot-id snap-123 --tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=restored-copy}]'  // avoid colliding tag","handlingStrategy":"validation","validationCode":"// Assert exactly one volume carries the name tag before updating\nout, _ := ec2Client.DescribeVolumes(ctx, &ec2.DescribeVolumesInput{Filters: nameTagFilters})\nif len(out.Volumes) > 1 {\n    return fmt.Errorf(\"cleanup needed: %d volumes share name %s\", len(out.Volumes), name)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never copy the kOps name tag to duplicate/restore-derived volumes","Keep volume name tags unique per cluster","Audit tags after snapshot-restore workflows"],"tags":["aws","ec2","ebs","tags"],"backgroundTag":"ambiguous-resource-name","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}