kubernetes/kops · error

missing prefix %q

Error message

missing prefix %q

What it means

parseInstanceIDFromProviderID requires the node's providerID to begin with the Linode prefix (e.g. 'linode://'); this guard fires for providerIDs in any other format. It means the Node's providerID was set by something other than the Linode cloud provider or is malformed, so the numeric instance ID cannot be extracted.

Source

Thrown at pkg/nodeidentity/linode/identify.go:126

	info := &nodeidentity.Info{
		InstanceID: instanceID,
		Labels:     buildLabelsFromTags(instance.Tags),
	}

	if i.cacheEnabled {
		if err := i.cache.Add(info); err != nil {
			klog.Warningf("Failed to add node identity info to cache: %v", err)
		}
	}

	return info, nil
}

// parseInstanceIDFromProviderID extracts the numeric instance ID and string ID from a provider ID.
// It supports formats like "linode://123", "linode:///123", and "linode://region/123".
func parseInstanceIDFromProviderID(providerID string) (int, string, error) {
	if !strings.HasPrefix(providerID, providerIDPrefix) {
		return 0, "", fmt.Errorf("missing prefix %q", providerIDPrefix)
	}

	raw := strings.TrimPrefix(providerID, providerIDPrefix)
	raw = strings.Trim(raw, "/")
	if raw == "" {
		return 0, "", fmt.Errorf("missing instance id")
	}

	parts := strings.Split(raw, "/")
	instanceID := parts[len(parts)-1]
	if instanceID == "" {
		return 0, "", fmt.Errorf("missing instance id")
	}

	linodeID, err := strconv.Atoi(instanceID)
	if err != nil {
		return 0, "", fmt.Errorf("invalid instance id %q: %w", instanceID, err)
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set node.spec.providerID to the linode://<instance-id> format
  2. Ensure the correct cloud-provider integration is stamping provider IDs on Linode nodes
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at pkg/nodeidentity/linode/identify.go:126 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/b8cfd8d5edefaaea. Report an issue: GitHub.