{"record":{"id":"349b875903b268dd","repo":"rancher/rancher","slug":"unknown-caller-kind-v","errorCode":null,"errorMessage":"unknown caller kind %v","messagePattern":"unknown caller kind (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"pkg/capr/configserver/custom.go","lineNumber":88,"sourceCode":"\n\tswitch lc.Kind {\n\tcase KindImported:\n\t\treturn &corev1.ObjectReference{\n\t\t\tAPIVersion: v3.SchemeGroupVersion.String(),\n\t\t\tKind:       \"Node\",\n\t\t\tNamespace:  machineNamespace,\n\t\t\tName:       machineName,\n\t\t}, nil\n\tcase KindCAPINative, KindV2Prov:\n\t\treturn &corev1.ObjectReference{\n\t\t\tAPIVersion: capi.GroupVersion.String(),\n\t\t\tKind:       \"Machine\",\n\t\t\tNamespace:  machineNamespace,\n\t\t\tName:       machineName,\n\t\t}, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown caller kind %v\", lc.Kind)\n}\n\nfunc (r *RKE2ConfigServer) findMachineByID(machineID, ns string) (*capi.Machine, error) {\n\tmachines, err := r.machineCache.List(ns, labels.SelectorFromSet(map[string]string{\n\t\tcapr.MachineIDLabel: machineID,\n\t}))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(machines) != 1 {\n\t\treturn nil, fmt.Errorf(\"unable to find machine %s, found %d machine(s)\", machineID, len(machines))\n\t}\n\n\treturn machines[0], nil\n}\n\nfunc (r *RKE2ConfigServer) createSecret(namespace, name string, data map[string]interface{}) (*corev1.Secret, error) {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/rancher/rancher/blob/932558d4e68565aff2d2f36e89ec4a391b06e7c5/pkg/capr/configserver/custom.go#L70-L106","documentation":"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.","triggerScenarios":"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.","commonSituations":"Partial Rancher upgrade leaving mixed component versions; local development with an unhandled kind; forks adding a kind but not this case.","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"],"exampleFix":"// before\nswitch lc.Kind {\ncase KindImported:\n    ...\ncase KindCAPINative, KindV2Prov:\n    ...\n}\nreturn nil, fmt.Errorf(\"unknown caller kind %v\", lc.Kind)\n\n// after (handle new kind explicitly)\nswitch lc.Kind {\ncase KindImported:\n    ...\ncase KindCAPINative, KindV2Prov:\n    ...\ncase KindNewProvisioner:\n    return &corev1.ObjectReference{ /* ... */ }, nil\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func knownCallerKind(k CallerKind) bool {\n    switch k {\n    case KindImported, KindCAPINative, KindV2Prov:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if !knownCallerKind(lc.Kind) {\n    return fmt.Errorf(\"lifecycle context has unsupported kind %q; component version skew?\", lc.Kind)\n}\n// proceed to machineRef()/configserver call","preventionTips":["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"],"tags":["configserver","invariant","version-skew","go","rke2"],"backgroundTag":null,"analyzedSha":"932558d4e68565aff2d2f36e89ec4a391b06e7c5","analyzedAt":"2026-08-16T04:37:02.125Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}