rancher/rancher · error
no cluster registration token found
Error message
no cluster registration token found
What it means
generateClusterAgentManifest builds the manifest that deploys cattle-cluster-agent onto nodes of a downstream cluster. For any management cluster other than the built-in 'local' one it looks up ClusterRegistrationTokens via the ClusterRegToken index on Spec.ManagementClusterName; an empty result means Rancher has not yet created (or has deleted) the registration token for that cluster, so no token can be embedded in the agent manifest.
Source
Thrown at pkg/capr/planner/agent.go:24
rkev1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1"
crt "github.com/rancher/rancher/pkg/controllers/dashboard/clusterregistrationtoken"
"github.com/rancher/rancher/pkg/systemtemplate"
)
// generateClusterAgentManifest generates a cluster agent manifest
func (p *Planner) generateClusterAgentManifest(controlPlane *rkev1.RKEControlPlane, entry *planEntry) ([]byte, error) {
if controlPlane.Spec.ManagementClusterName == "local" {
return nil, nil
}
tokens, err := p.clusterRegistrationTokenCache.GetByIndex(ClusterRegToken, controlPlane.Spec.ManagementClusterName)
if err != nil {
return nil, err
}
if len(tokens) == 0 {
return nil, fmt.Errorf("no cluster registration token found")
}
sort.Slice(tokens, func(i, j int) bool {
return tokens[i].Name < tokens[j].Name
})
mgmtCluster, err := p.managementClusters.Get(controlPlane.Spec.ManagementClusterName)
if err != nil {
return nil, err
}
taints, err := getTaints(entry, controlPlane)
if err != nil {
return nil, err
}
token, err := crt.GetTokenFromSecret(p.secretCache, tokens[0])
if err != nil {View on GitHub (pinned to 932558d4e6)
Solutions
- Wait for reconciliation: the planner requeues and succeeds once the token exists
- Confirm the token object exists: kubectl get clusterregistrationtokens.management.cattle.io -A | grep <cluster-name>
- If missing, inspect rancher's clusterregistrationtoken controller logs and restart the rancher deployment to re-trigger creation
- For imported clusters, re-run the agent-installation flow to regenerate registration state
Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: confirm a registration token exists before expecting agent manifests
tokens, err := crtCache.GetByIndex(ClusterRegToken, mgmtClusterName)
if err != nil {
return err
}
if len(tokens) == 0 {
return fmt.Errorf("no clusterregistrationtoken for %s yet; requeue", mgmtClusterName)
} Prevention
- Expect first plan renders of a new cluster to race the clusterregistrationtoken controller; rely on planner requeue
- Verify clusterregistrationtokens exist before scaling downstream nodes
- Do not manually delete ClusterRegistrationToken objects
- After Rancher upgrades, allow informer caches to sync before provisioning
When it happens
Trigger: The planner renders the plan for a machine immediately after cluster creation, before rancher's clusterregistrationtoken controller has created the token object; the token was manually deleted; controller/index not yet synced after a Rancher restart.
Common situations: Race between planner and dashboard controllers on brand-new or imported clusters; downstream agent deployment failing on the first plan attempts; Rancher upgrades where informer caches start empty.
Related errors
- ServerError
- unable to get token name from content
- invalid action
- InvalidType
- failed to find schema ${apiContext.Type}
AI-assisted analysis of rancher/rancher@932558d4e6 (2026-08-16).
Data as JSON: /api/errors/e2d10786a5abbd9b.
Report an issue: GitHub.