{"record":{"id":"c5119702c0e5769b","repo":"kubernetes/kops","slug":"failed-to-convert-network-id-q-to-int-w-c51197","errorCode":null,"errorMessage":"failed to convert network ID %q to int: %w","messagePattern":"failed to convert network ID %q to int: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/hetznertasks/servergroup.go","lineNumber":220,"sourceCode":"\t\treturn fmt.Errorf(\"failed to find ssh keys for server group %q\", fi.ValueOf(e.Name))\n\t}\n\tif e.Network == nil {\n\t\treturn fmt.Errorf(\"failed to find network for server group %q\", fi.ValueOf(e.Name))\n\t}\n\n\tuserData, err := fi.ResourceAsString(e.UserData)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuserDataBytes, err := fi.ResourceAsBytes(e.UserData)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuserDataHash := SafeBytesHash(userDataBytes)\n\n\tnetworkID, err := strconv.ParseInt(fi.ValueOf(e.Network.ID), 10, 64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to convert network ID %q to int: %w\", fi.ValueOf(e.Network.ID), err)\n\t}\n\n\tfor i := 1; i <= expectedCount-actualCount; i++ {\n\t\t// Append a random/unique ID to the node name\n\t\tname := fmt.Sprintf(\"%s-%x\", fi.ValueOf(e.Name), rand.Int63())\n\n\t\topts := hcloud.ServerCreateOpts{\n\t\t\tName:             name,\n\t\t\tStartAfterCreate: new(true),\n\t\t\tNetworks: []*hcloud.Network{\n\t\t\t\t{\n\t\t\t\t\tID: networkID,\n\t\t\t\t},\n\t\t\t},\n\t\t\tLocation: &hcloud.Location{\n\t\t\t\tName: e.Location,\n\t\t\t},\n\t\t\tServerType: &hcloud.ServerType{","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/hetznertasks/servergroup.go#L202-L238","documentation":"When rendering a Hetzner ServerGroup task, kOps converts the ID of the referenced Hetzner network (e.Network.ID) to a 64-bit integer with strconv.ParseInt. If the network ID string is empty or non-numeric, the parse fails and this wrapped error is returned, aborting server group creation.","triggerScenarios":"RenderHetzner is called for a HetznerServerGroup whose Network.ID is nil/empty, or contains non-numeric text (e.g. a network name like 'my-net' instead of the numeric Hetzner network ID).","commonSituations":"Cluster config omits network.id, or a user pastes the Hetzner network name/label instead of its numeric ID from the Hetzner Cloud console; also happens when the network reference is resolved incorrectly during cluster spec generation.","solutions":["Set a valid numeric Hetzner network ID in the cluster spec (network.id), obtainable from the Hetzner Cloud console or `hcloud network list`.","Verify the network reference resolves to the ID field, not the name field, in the instance group / cluster YAML.","Run `kops replace -f cluster.yaml` (or edit) after fixing the spec and re-run the update."],"exampleFix":"// before (cluster.yaml)\nnetwork:\n  id: my-hetzner-network\n// after\nnetwork:\n  id: \"4711\"","handlingStrategy":"validation","validationCode":"id := fi.ValueOf(sg.Network.ID)\nif n, err := strconv.ParseInt(id, 10, 64); err != nil || n <= 0 {\n\treturn fmt.Errorf(\"hetzner network id must be a positive integer, got %q\", id)\n}","typeGuard":"func validHetznerNetworkID(id string) bool {\n\tn, err := strconv.ParseInt(id, 10, 64)\n\treturn err == nil && n > 0\n}","tryCatchPattern":"if err := renderHetzner(...); err != nil {\n\tif strings.Contains(err.Error(), \"failed to convert network ID\") {\n\t\t// fix cluster spec network.id and retry\n\t}\n}","preventionTips":["Always use the numeric Hetzner network ID from `hcloud network list`, never the network name","Quote numeric IDs in YAML so parsers do not mangle them","Validate cluster.spec.network.id before running kops update"],"tags":["hetzner","network-id","strconv","config-validation"],"backgroundTag":"invalid-numeric-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"}