kubernetes/kops · error
failed to convert server ID %q to int: %w
Error message
failed to convert server ID %q to int: %w
What it means
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.
Source
Thrown at pkg/nodeidentity/hetzner/identify.go:145
if err != nil {
klog.Warningf("Failed to add node identity info to cache: %v", err)
}
}
return info, nil
}
// stringKeyFunc is a string as cache key function
func stringKeyFunc(obj interface{}) (string, error) {
key := obj.(*nodeidentity.Info).InstanceID
return key, nil
}
// getServer queries Hetzner Cloud for the server with the specified ID, returning an error if not found
func (i *nodeIdentifier) getServer(id string) (*hcloud.Server, error) {
serverID, err := strconv.ParseInt(id, 10, 64)
if err != nil {
return nil, fmt.Errorf("failed to convert server ID %q to int: %w", id, err)
}
server, _, err := i.client.Server.GetByID(context.TODO(), serverID)
if err != nil || server == nil {
return nil, fmt.Errorf("failed to get info for server %q: %w", id, err)
}
return server, nil
}
View on GitHub (pinned to 4c8573c808)
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
Example fix
// before providerID: hcloud://my-node-1 // after providerID: hcloud://42981517
Defensive patterns
Strategy: validation
Validate before calling
if _, err := strconv.ParseInt(strings.TrimPrefix(node.Spec.ProviderID, "hcloud://"), 10, 64); err != nil { /* fix providerID first */ } Type guard
func hcloudServerID(n *corev1.Node) (int64, bool) {
id, ok := strings.CutPrefix(n.Spec.ProviderID, "hcloud://")
if !ok { return 0, false }
v, err := strconv.ParseInt(id, 10, 64)
return v, err == nil
} Try / catch
info, err := IdentifyNode(ctx, node)
if err != nil && strings.Contains(err.Error(), "failed to convert server ID") {
// malformed providerID: fix Node spec and requeue
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- providerID %q not recognized for node %s
- unexpected form of resource path: %q
- providerID %q not recognized
- error parsing providerID: %v
- failed to convert provider ID number %q: %s
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/3a7f8aa4983b051e.
Report an issue: GitHub.