{"record":{"id":"ec078fe178f32c2a","repo":"rancher/rancher","slug":"no-config-content","errorCode":null,"errorMessage":"no config content","messagePattern":"no config content","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"pkg/capr/configserver/server.go","lineNumber":237,"sourceCode":"\n\tkubernetesVersion, err := r.getClusterKubernetesVersion(mpSecret.Labels[capi.ClusterNameLabel], ns)\n\tif err != nil {\n\t\thttp.Error(rw, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar content string\n\tfor _, f := range config[\"files\"].([]interface{}) {\n\t\tf := f.(map[string]interface{})\n\t\tif path, ok := f[\"path\"].(string); ok && path == fmt.Sprintf(planner.ConfigYamlFileName, capr.GetRuntime(kubernetesVersion)) {\n\t\t\tif _, ok := f[\"content\"]; ok {\n\t\t\t\tcontent = f[\"content\"].(string)\n\t\t\t}\n\t\t}\n\t}\n\n\tif content == \"\" {\n\t\thttp.Error(rw, \"no config content\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tjsonContent, err := base64.StdEncoding.DecodeString(content)\n\tif err != nil {\n\t\thttp.Error(rw, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\trw.Header().Set(\"Content-Type\", \"application/json\")\n\t_, _ = rw.Write(jsonContent)\n}\n\nfunc (r *RKE2ConfigServer) connectClusterInfo(secret *corev1.Secret, rw http.ResponseWriter, req *http.Request) {\n\theaders := dataFromHeaders(req)\n\n\t// expecting -H \"X-Cattle-Field: kubernetesversion\" -H \"X-Cattle-Field: name\"\n\tfields, ok := headers[\"field\"]","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/rancher/rancher/blob/932558d4e68565aff2d2f36e89ec4a391b06e7c5/pkg/capr/configserver/server.go#L219-L255","documentation":"connectConfigYaml scans the plan's files array for the entry whose path equals planner.ConfigYamlFileName for the detected runtime (rke2 vs k3s) and takes its content. If no entry matches, or the matched entry's content is empty, it returns the fixed 500 'no config content' - the plan did not include the runtime config file the server expected.","triggerScenarios":"A plan whose files list omits the runtime config file (for example /etc/rancher/rke2/config.yaml.d/50-rancher.yaml or the k3s equivalent), or whose matching entry has empty content; runtime detection disagreeing with what was planned when kubernetesVersion cannot be resolved.","commonSituations":"Custom plan templates built without the rancher config file; version skew changing the expected filename; plans for machines whose version label is missing so GetRuntime falls back unexpectedly.","solutions":["Inspect the files: kubectl ... | jq -r '.files[].path' and confirm the runtime-specific config file exists with non-empty content.","Regenerate the plan (delete the plan secret / re-plan the machine) so the planner injects the config file.","Verify the cluster's kubernetesVersion resolves - the expected filename depends on GetRuntime(version).","If using custom plan templates, add the expected config file entry with content."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"kubectl -n <ns> get secret <name> -o jsonpath='{.data.rolePlan}' | base64 -d | jq '[.files[].path] | map(select(contains(\"config.yaml\")))' # must list the runtime config file","typeGuard":"func hasRuntimeConfig(files []interface{}, runtime string) bool {\n\twant := fmt.Sprintf(planner.ConfigYamlFileName, runtime)\n\tfor _, f := range files {\n\t\tm, ok := f.(map[string]interface{})\n\t\tif !ok { continue }\n\t\tif p, _ := m[\"path\"].(string); p == want {\n\t\t\tif c, _ := m[\"content\"].(string); c != \"\" { return true }\n\t\t}\n\t}\n\treturn false\n}","tryCatchPattern":"if content == \"\" { trigger re-plan; do not fabricate a config; alert on plan-generation regression }","preventionTips":["Ensure custom plan templates include the runtime config file entry with non-empty base64 content.","Verify the cluster kubernetesVersion is set - the expected filename depends on the runtime."],"tags":["rancher","provisioning","rke2","config"],"backgroundTag":null,"analyzedSha":"932558d4e68565aff2d2f36e89ec4a391b06e7c5","analyzedAt":"2026-08-16T04:37:02.125Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}