{"record":{"id":"73454bfa91c675f3","repo":"kubernetes/kubernetes","slug":"failed-to-marshal-base-config-w","errorCode":null,"errorMessage":"failed to marshal base config: %w","messagePattern":"failed to marshal base config: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kubelet/app/server.go","lineNumber":351,"sourceCode":"// configurations in files with lower numeric prefixes are applied first, followed by higher numeric prefixes.\n// For example, if the drop-in directory contains files named \"10-config.conf\" and \"20-config.conf\",\n// the configurations in \"10-config.conf\" will be applied first, and then the configurations in \"20-config.conf\" will be applied,\n// potentially overriding the previous values. Files in subdirectories are also processed in lexical order.\n// Returns a list of skipped files and an error.\nfunc mergeKubeletConfigurations(kubeletConfig *kubeletconfiginternal.KubeletConfiguration, kubeletDropInConfigDir string) ([]string, error) {\n\tconst dropinFileExtension = \".conf\"\n\tvar skippedFiles []string\n\n\t// TODO: move the \"internal --> versioned --> merge --> default --> internal\" operation inside the loop,\n\t// and use the version of each drop-in file as the versioned target once config files can be in versions other than just v1beta1\n\tversionedConfig := &kubeletconfigv1beta1.KubeletConfiguration{}\n\tif err := kubeletconfigv1beta1conversion.Convert_config_KubeletConfiguration_To_v1beta1_KubeletConfiguration(kubeletConfig, versionedConfig, nil); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseKubeletConfigJSON, err := json.Marshal(versionedConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal base config: %w\", err)\n\t}\n\t// Walk through the drop-in directory and update the configuration for each file\n\tif err := filepath.WalkDir(kubeletDropInConfigDir, func(path string, info fs.DirEntry, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tif filepath.Ext(info.Name()) != dropinFileExtension {\n\t\t\tskippedFiles = append(skippedFiles, path)\n\t\t\treturn nil\n\t\t}\n\t\tdropinConfigJSON, gvk, err := loadDropinConfigFileIntoJSON(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to load kubelet dropin file, path: %s, error: %w\", path, err)\n\t\t}\n\t\tif gvk == nil || gvk.Empty() {","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/b882c60b4023bdf09264c2d5d30a2cadebc240fb/cmd/kubelet/app/server.go#L333-L369","documentation":"Returned inside mergeKubeletConfigurations (cmd/kubelet/app/server.go:351) when json.Marshal of the versioned base KubeletConfiguration fails while preparing the base JSON for drop-in merging. Because KubeletConfiguration is a well-defined struct with marshalable field types, a marshal failure is effectively a programming/scheme-conversion error rather than a user config problem.","triggerScenarios":"A field on the v1beta1 KubeletConfiguration that cannot be JSON-marshaled after the Convert_config_KubeletConfiguration_To_v1beta1 conversion — e.g. a channel/func type introduced by a bug, or a custom type lacking JSON support. Reached only when --config-dir is set.","commonSituations":"A kubelet build with a regression in the config scheme conversion; essentially never seen in released versions. If hit, it indicates a binary/scheme bug, not a configuration mistake.","solutions":["Confirm you are running an official, unmodified kubelet build for your Kubernetes version.","Temporarily remove --config-dir to bypass the drop-in merge path and confirm startup proceeds.","File a Kubernetes issue with the version and the wrapped marshal error, since this reflects a scheme/conversion defect."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"skipped, err := mergeKubeletConfigurations(kubeletConfig, dropInDir)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to marshal base config\") {\n        // scheme/conversion bug — report upstream, drop --config-dir to proceed\n    }\n    return err\n}","preventionTips":["Use official, unmodified kubelet builds.","If hit, remove --config-dir as a workaround and file an upstream issue.","Pin a known-good kubelet version until the scheme bug is fixed."],"tags":["config-dir","kubelet","marshal","startup","bug"],"analyzedSha":"b882c60b4023bdf09264c2d5d30a2cadebc240fb","analyzedAt":"2026-08-07T04:07:48.144Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}