{"record":{"id":"c35c5e7773b9884e","repo":"kubernetes/kops","slug":"failed-to-convert-server-id-q-to-int-w-c35c5e","errorCode":null,"errorMessage":"failed to convert server ID %q to int: %w","messagePattern":"failed to convert server ID %q to int: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/hetzner/cloud.go","lineNumber":254,"sourceCode":"\tvolumeListOptions := hcloud.VolumeListOpts{ListOpts: listOptions}\n\n\tmatches, err := client.AllWithOpts(context.TODO(), volumeListOptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get volumes matching label selector %q: %w\", labelSelector, err)\n\t}\n\n\treturn matches, nil\n}\n\nfunc (c *hetznerCloudImplementation) DNS() (dnsprovider.Interface, error) {\n\t// Hetzner LB has a stable internal IP and can use that instead of creating a record for api.internal.\n\treturn nil, nil\n}\n\nfunc (c *hetznerCloudImplementation) DeleteInstance(instance *cloudinstances.CloudInstance) error {\n\tserverID, err := strconv.ParseInt(instance.ID, 10, 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to convert server ID %q to int: %w\", instance.ID, err)\n\t}\n\n\terr = deleteServer(c, serverID)\n\n\treturn err\n}\n\n// deleteServer shuts down and deletes the given server\nfunc deleteServer(c *hetznerCloudImplementation, id int64) error {\n\tclient := c.ServerClient()\n\tctx := context.TODO()\n\n\tserver := &hcloud.Server{ID: id}\n\t_, _, err := client.Shutdown(ctx, server)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to stop server %q: %w\", strconv.FormatInt(id, 10), err)\n\t}\n","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/hetzner/cloud.go#L236-L272","documentation":"DeleteInstance parses the CloudInstance ID string as an int64 Hetzner server ID before deleting; this error is thrown when strconv.ParseInt fails, meaning the instance ID is not a numeric Hetzner server ID.","triggerScenarios":"Calling DeleteInstance with a CloudInstance whose ID was populated from a non-Hetzner source (e.g. a node name, UUID, or an ID format change) instead of the numeric Hetzner server ID.","commonSituations":"Kubernetes node objects whose providerID/instance mapping does not carry the numeric Hetzner server ID, custom tooling building CloudInstance structs manually, or kOps/Hetzner provider-ID format changes after upgrades.","solutions":["Ensure the CloudInstance ID is the numeric Hetzner server ID (from providerID hcloud://<id>)","Fix whatever populated instance.ID (node providerID parsing) to extract only the numeric part","Check for leading/trailing whitespace or prefix text in the ID and trim/strip it","Verify kOps and hetzner cloud provider versions agree on ID format"],"exampleFix":"// before\nserverID, err := strconv.ParseInt(instance.ID, 10, 64)\n// after\nid := strings.TrimPrefix(instance.ID, \"hcloud://\")\nserverID, err := strconv.ParseInt(id, 10, 64)\nif err != nil {\n\treturn fmt.Errorf(\"failed to convert server ID %q to int: %w\", id, err)\n}","handlingStrategy":"validation","validationCode":"serverID, err := strconv.ParseInt(strings.TrimSpace(strings.TrimPrefix(instance.ID, \"hcloud://\")), 10, 64)\nif err != nil {\n\treturn fmt.Errorf(\"instance ID %q is not a numeric Hetzner server ID\", instance.ID)\n}","typeGuard":"func isNumericServerID(id string) bool {\n\t_, err := strconv.ParseInt(id, 10, 64)\n\treturn err == nil\n}","tryCatchPattern":null,"preventionTips":["Always populate CloudInstance.ID from the numeric Hetzner server ID (hcloud://<id> providerID)","Validate IDs are numeric before calling DeleteInstance","Trim providerID scheme prefixes before parsing","Watch for format changes after kOps/provider upgrades"],"tags":["hetzner","instance","parse","id-format"],"backgroundTag":"invalid-instance-id","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"}