{"record":{"id":"3a7f8aa4983b051e","repo":"kubernetes/kops","slug":"failed-to-convert-server-id-q-to-int-w","errorCode":null,"errorMessage":"failed to convert server ID %q to int: %w","messagePattern":"failed to convert server ID %q to int: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/hetzner/identify.go","lineNumber":145,"sourceCode":"\t\tif err != nil {\n\t\t\tklog.Warningf(\"Failed to add node identity info to cache: %v\", err)\n\t\t}\n\t}\n\n\treturn info, nil\n}\n\n// stringKeyFunc is a string as cache key function\nfunc stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*nodeidentity.Info).InstanceID\n\treturn key, nil\n}\n\n// getServer queries Hetzner Cloud for the server with the specified ID, returning an error if not found\nfunc (i *nodeIdentifier) getServer(id string) (*hcloud.Server, error) {\n\tserverID, err := strconv.ParseInt(id, 10, 64)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to convert server ID %q to int: %w\", id, err)\n\t}\n\tserver, _, err := i.client.Server.GetByID(context.TODO(), serverID)\n\tif err != nil || server == nil {\n\t\treturn nil, fmt.Errorf(\"failed to get info for server %q: %w\", id, err)\n\t}\n\n\treturn server, nil\n}\n","sourceCodeStart":127,"sourceCodeEnd":154,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/hetzner/identify.go#L127-L154","documentation":"The server ID extracted from the providerID could not be parsed as an integer, which getServer requires to call Hetzner's Server.GetByID. This wraps strconv.ParseInt's error with the offending string.","triggerScenarios":"strconv.ParseInt(id, 10, 64) fails because the portion after 'hcloud://' is non-numeric — e.g. 'hcloud://my-server-name' or 'hcloud://12345-foo' instead of a numeric Hetzner server ID.","commonSituations":"Hand-written providerID using server names instead of IDs; custom CCM emitting a different format; copy/paste of the server name from the Hetzner console rather than its numeric ID.","solutions":["Set providerID to the numeric server ID: hcloud://<id> (find via `hcloud server list`)","Fix whatever component generates providerIDs (kubelet --provider-id or CCM) to use numeric IDs","Delete the misconfigured Node and let it re-register with a correct providerID"],"exampleFix":"// before\nproviderID: hcloud://my-node-1\n// after\nproviderID: hcloud://42981517","handlingStrategy":"validation","validationCode":"if _, err := strconv.ParseInt(strings.TrimPrefix(node.Spec.ProviderID, \"hcloud://\"), 10, 64); err != nil { /* fix providerID first */ }","typeGuard":"func hcloudServerID(n *corev1.Node) (int64, bool) {\n  id, ok := strings.CutPrefix(n.Spec.ProviderID, \"hcloud://\")\n  if !ok { return 0, false }\n  v, err := strconv.ParseInt(id, 10, 64)\n  return v, err == nil\n}","tryCatchPattern":"info, err := IdentifyNode(ctx, node)\nif err != nil && strings.Contains(err.Error(), \"failed to convert server ID\") {\n  // malformed providerID: fix Node spec and requeue\n}","preventionTips":["Always use numeric Hetzner server IDs in providerID, never names","Get the ID via `hcloud server list` before setting --provider-id","Lint providerID format on Node admission"],"tags":["hetzner","provider-id","parsing","format-validation"],"backgroundTag":"invalid-provider-id-format","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"}