kubernetes/kops · error
provider ID %q is missing prefix %q
Error message
provider ID %q is missing prefix %q
What it means
IdentifyNode expects a provider ID in the form 'digitalocean://<id>'. If the supplied providerID string does not start with the 'digitalocean://' scheme, it is rejected with this error because the droplet ID cannot be extracted.
Source
Thrown at pkg/nodeidentity/do/identify.go:127
bodyBytes, err := io.ReadAll(resp.Body)
if err != nil {
return "", fmt.Errorf("failed to read metadata information %s: %v", url, err)
}
return string(bodyBytes), nil
}
// IdentifyNode queries DigitalOcean for the node identity information.
func (i *nodeIdentifier) IdentifyNode(ctx context.Context, node *corev1.Node) (*nodeidentity.Info, error) {
providerID := node.Spec.ProviderID
if providerID == "" {
return nil, errors.New("provider ID cannot be empty")
}
const prefix = "digitalocean://"
if !strings.HasPrefix(providerID, prefix) {
return nil, fmt.Errorf("provider ID %q is missing prefix %q", providerID, prefix)
}
instanceID := strings.TrimPrefix(providerID, prefix)
if instanceID == "" {
return nil, errors.New("provider ID number cannot be empty")
}
if i.cacheEnabled {
if obj, exists, err := i.cache.GetByKey(instanceID); err != nil {
klog.Warningf("Nodeidentity info cache lookup failure: %v", err)
} else if exists {
return obj.(*nodeidentity.Info), nil
}
}
dropletID, err := strconv.Atoi(instanceID)
if err != nil {
return nil, fmt.Errorf("failed to convert provider ID number %q: %s", instanceID, err)View on GitHub (pinned to 4c8573c808)
Solutions
- Verify the Node's spec.providerID starts with exactly 'digitalocean://'
- Correct the providerID source (ensure the DigitalOcean CCM is running and setting providerIDs)
- If constructing the ID manually, prefix the numeric droplet ID with 'digitalocean://'
- Check for other cloud controllers stamping their own providerID onto the Node
Example fix
// before IdentifyNode(ctx, "12345678") // after IdentifyNode(ctx, "digitalocean://12345678")
Defensive patterns
Strategy: validation
Validate before calling
const prefix = "digitalocean://"
if !strings.HasPrefix(providerID, prefix) {
return fmt.Errorf("invalid provider ID %q", providerID)
} Type guard
func isDOProviderID(id string) bool {
return strings.HasPrefix(id, "digitalocean://")
} Try / catch
info, err := IdentifyNode(ctx, providerID)
if err != nil {
if strings.Contains(err.Error(), "missing prefix") {
// reject or fix the providerID before retrying
}
} Prevention
- Ensure the DigitalOcean CCM is running so Nodes get correct providerIDs
- Validate providerID format before passing it to identity lookups
- Never hand-edit Node spec.providerID; let the controller own it
- Check for competing cloud controllers stamping other schemes
When it happens
Trigger: A Node object's spec.providerID was set by a different cloud provider or left in another format (e.g. 'digitalocean:12345', 'do://12345', or a bare numeric ID) and passed to IdentifyNode.
Common situations: Clusters migrated between providers; CCM/node controller misconfigured so providerID is populated incorrectly; hand-edited Node specs; older kops/DO CCM versions using a different scheme.
Related errors
- failed to convert provider ID number %q: %s
- DIGITALOCEAN_ACCESS_TOKEN is required
- DIGITALOCEAN_ACCESS_TOKEN is required
- deleting droplets is not supported yet
- failed to parse objects: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/1758f90d31751bd5.
Report an issue: GitHub.