rancher/rancher · error
unknown caller kind %v
Error message
unknown caller kind %v
What it means
The switch in pkg/capr/configserver/custom.go maps a CallerKind (KindImported, KindCAPINative, KindV2Prov) to an ObjectReference for the requesting machine. Any other value falls through to 'unknown caller kind'. CallerKind originates from the LifecycleContext built in identity.go, so this is an internal invariant break — not user-supplied input.
Source
Thrown at pkg/capr/configserver/custom.go:88
switch lc.Kind {
case KindImported:
return &corev1.ObjectReference{
APIVersion: v3.SchemeGroupVersion.String(),
Kind: "Node",
Namespace: machineNamespace,
Name: machineName,
}, nil
case KindCAPINative, KindV2Prov:
return &corev1.ObjectReference{
APIVersion: capi.GroupVersion.String(),
Kind: "Machine",
Namespace: machineNamespace,
Name: machineName,
}, nil
}
return nil, fmt.Errorf("unknown caller kind %v", lc.Kind)
}
func (r *RKE2ConfigServer) findMachineByID(machineID, ns string) (*capi.Machine, error) {
machines, err := r.machineCache.List(ns, labels.SelectorFromSet(map[string]string{
capr.MachineIDLabel: machineID,
}))
if err != nil {
return nil, err
}
if len(machines) != 1 {
return nil, fmt.Errorf("unable to find machine %s, found %d machine(s)", machineID, len(machines))
}
return machines[0], nil
}
func (r *RKE2ConfigServer) createSecret(namespace, name string, data map[string]interface{}) (*corev1.Secret, error) {View on GitHub (pinned to 932558d4e6)
Solutions
- Verify all Rancher components run the same version (rollout restart the deployment)
- If developing: extend the switch at pkg/capr/configserver/custom.go:88 with the new CallerKind case
- Report upstream with the lifecycle context details if it reproduces on a stock build
Example fix
// before
switch lc.Kind {
case KindImported:
...
case KindCAPINative, KindV2Prov:
...
}
return nil, fmt.Errorf("unknown caller kind %v", lc.Kind)
// after (handle new kind explicitly)
switch lc.Kind {
case KindImported:
...
case KindCAPINative, KindV2Prov:
...
case KindNewProvisioner:
return &corev1.ObjectReference{ /* ... */ }, nil
} Defensive patterns
Strategy: type-guard
Type guard
func knownCallerKind(k CallerKind) bool {
switch k {
case KindImported, KindCAPINative, KindV2Prov:
return true
}
return false
} Try / catch
if !knownCallerKind(lc.Kind) {
return fmt.Errorf("lifecycle context has unsupported kind %q; component version skew?", lc.Kind)
}
// proceed to machineRef()/configserver call Prevention
- Pin all Rancher components to one version and roll them together
- When adding a CallerKind, update every switch over it (custom.go, machineRequestSecretName) in the same change
- Guard the configserver entry point with a knownCallerKind check so skew fails with a clear message
When it happens
Trigger: A LifecycleContext constructed with an empty or unrecognized Kind: a new CallerKind constant added without extending this switch (version skew between components), or a zero-value context reaching the configserver.
Common situations: Partial Rancher upgrade leaving mixed component versions; local development with an unhandled kind; forks adding a kind but not this case.
Related errors
- unable to find machine %s, found %d machine(s)
- timeout waiting for %s/%s to be ready
- mgmt cluster %s carries only one of %s/%s; both must be set
- mgmt cluster %s references CAPI cluster %s/%s, but that clus
- unable to find cluster name for machine
AI-assisted analysis of rancher/rancher@932558d4e6 (2026-08-16).
Data as JSON: /api/errors/349b875903b268dd.
Report an issue: GitHub.