{"record":{"id":"3df160c88f0d898d","repo":"kubernetes/kops","slug":"failed-to-create-cloud-group-instance-for-server","errorCode":null,"errorMessage":"failed to create cloud group instance for server %s(%d): %w","messagePattern":"failed to create cloud group instance for server (.+?)\\((.+?)\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/hetzner/cloud.go","lineNumber":384,"sourceCode":"\tcloudInstanceGroup := &cloudinstances.CloudInstanceGroup{\n\t\tHumanName:     ig.Name,\n\t\tInstanceGroup: ig,\n\t\tRaw:           sg,\n\t\tMinSize:       int(fi.ValueOf(ig.Spec.MinSize)),\n\t\tTargetSize:    int(fi.ValueOf(ig.Spec.MinSize)),\n\t\tMaxSize:       int(fi.ValueOf(ig.Spec.MaxSize)),\n\t}\n\n\tfor _, server := range sg {\n\t\tstatus := cloudinstances.CloudInstanceStatusUpToDate\n\t\tif _, ok := server.Labels[TagKubernetesInstanceNeedsUpdate]; ok {\n\t\t\tstatus = cloudinstances.CloudInstanceStatusNeedsUpdate\n\t\t}\n\n\t\tid := strconv.FormatInt(server.ID, 10)\n\t\tcloudInstance, err := cloudInstanceGroup.NewCloudInstance(id, status, nodeMap[id])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create cloud group instance for server %s(%d): %w\", server.Name, server.ID, err)\n\t\t}\n\n\t\t// Add additional instance info\n\t\tcloudInstance.State = cloudinstances.State(server.Status)\n\t\tif role, ok := server.Labels[TagKubernetesInstanceRole]; ok {\n\t\t\tcloudInstance.Roles = append(cloudInstance.Roles, role)\n\t\t}\n\t\tif server.ServerType != nil {\n\t\t\tcloudInstance.MachineType = server.ServerType.Name\n\t\t}\n\t\tif len(server.PrivateNet) > 0 {\n\t\t\tcloudInstance.PrivateIP = server.PrivateNet[0].IP.String()\n\t\t}\n\t}\n\n\treturn cloudInstanceGroup, nil\n}\n","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/hetzner/cloud.go#L366-L402","documentation":"buildCloudInstanceGroup calls NewCloudInstance, which rejects duplicate instance IDs within a group. This error wraps that failure for a Hetzner server, meaning two servers mapped to the same cloud instance group carry the same numeric ID (or the group state is inconsistent).","triggerScenarios":"A server with an ID already present in the CloudInstanceGroup is processed again, e.g. duplicate servers listed or a server added twice to Ready/NeedUpdate sets.","commonSituations":"Corrupted cloud state after an interrupted scaling operation; manually duplicated Hetzner servers sharing the kops instance-group label; a kOps bug reprocessing the same server list entry.","solutions":["Inspect the server name/ID in the message and look for duplicate Hetzner servers with the same kops instance-group label.","Delete any manually created duplicate servers so each ID is unique per group.","Re-run `kops get instancegroups` / rolling-update to refresh group state.","If caused by an interrupted operation, wait for reconciliation or run a rolling update to converge state."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"seen := map[int64]bool{}\nfor _, s := range servers {\n  if seen[s.ID] { return fmt.Errorf(\"duplicate server ID %d in group %s\", s.ID, groupName) }\n  seen[s.ID] = true\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-create Hetzner servers with kops instance-group labels; use kOps-managed instance groups.","Deduplicate server lists by ID before building groups.","Reconcile cloud state with `kops update cluster` after manual console changes."],"tags":["hetzner","cloud-groups","duplicate-id"],"backgroundTag":"duplicate-instance-id","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"}