{"record":{"id":"7139a0d0df046d2e","repo":"kubernetes/kops","slug":"marshalling-nodeupconfig-w","errorCode":null,"errorMessage":"marshalling nodeupConfig: %w","messagePattern":"marshalling nodeupConfig: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/server/node_config.go","lineNumber":92,"sourceCode":"\n\t\tp := s.configBase.Join(\"igconfig\", \"node\", instanceGroupName, \"nodeupconfig.yaml\")\n\n\t\tb, err := p.ReadFile(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error loading NodeupConfig %q: %v\", p, err)\n\t\t}\n\t\tnodeConfig = &nodeup.NodeConfig{}\n\t\tnodeConfig.NodeupConfig = string(b)\n\t}\n\n\tif nodeConfig == nil {\n\t\tbootstrapData, err := configBuilder.GetBootstrapData(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"building nodeConfig for instanceGroup: %w\", err)\n\t\t}\n\t\tnodeupConfig, err := json.Marshal(bootstrapData.NodeupConfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"marshalling nodeupConfig: %w\", err)\n\t\t}\n\t\tnodeConfig = &nodeup.NodeConfig{}\n\t\tnodeConfig.NodeupConfig = string(nodeupConfig)\n\t}\n\n\t{\n\t\tsecretIDs := []string{\n\t\t\t\"dockerconfig\",\n\t\t}\n\t\tnodeConfig.NodeSecrets = make(map[string][]byte)\n\t\tfor _, id := range secretIDs {\n\t\t\tsecret, err := s.secretStore.FindSecret(id)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error loading secret %q: %w\", id, err)\n\t\t\t}\n\t\t\tif secret != nil && secret.Data != nil {\n\t\t\t\tnodeConfig.NodeSecrets[id] = secret.Data\n\t\t\t}","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/server/node_config.go#L74-L110","documentation":"After GetBootstrapData succeeds, getNodeConfig serializes bootstrapData.NodeupConfig to JSON for embedding in NodeConfig. This error means json.Marshal failed on that structure, which is nearly impossible for ordinary data and indicates an invalid value in the config graph (e.g. invalid custom fields).","triggerScenarios":"json.Marshal(bootstrapData.NodeupConfig) returns an error, only possible if NodeupConfig contains unsupported values (e.g. NaN-like numbers via custom types, channels/funcs in unmarshalable custom fields).","commonSituations":"A kOps version regression or custom nodeup config field introduced unserializable data; corrupted cluster state decoded into an invalid struct.","solutions":["Log the wrapped marshal error for the offending field","Check for recent kOps version changes or custom patches to NodeupConfig","Regenerate nodeup config via kops update cluster","Report to kOps maintainers with the wrapped error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"cfg, err := json.Marshal(bootstrapData.NodeupConfig)\nif err != nil {\n    return nil, fmt.Errorf(\"marshalling nodeupConfig: %w\", err)\n}","preventionTips":["Avoid custom unserializable fields in NodeupConfig","Run round-trip marshal tests on generated configs","Pin tested kOps versions"],"tags":["go","json","serialization","nodeup"],"backgroundTag":"json-marshal-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}