{"record":{"id":"0c66c578a632950c","repo":"kubernetes/kops","slug":"building-static-config-w","errorCode":null,"errorMessage":"building static config: %w","messagePattern":"building static config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/components/etcdmanager/model.go","lineNumber":545,"sourceCode":"\n\t\tcase kops.CloudProviderMetal:\n\t\t\tconfig.VolumeProvider = \"external\"\n\t\t\tconfig.BackupStore = \"file:///mnt/disks/backups\"\n\t\t\tconfig.VolumeTag = []string{\n\t\t\t\tfmt.Sprintf(\"%s--%s--\", b.Cluster.Name, etcdCluster.Name),\n\t\t\t}\n\n\t\t\tstaticConfig := &StaticConfig{\n\t\t\t\tEtcdVersion: etcdCluster.Version,\n\t\t\t}\n\t\t\tstaticConfig.Nodes = append(staticConfig.Nodes, StaticConfigNode{\n\t\t\t\tID: fmt.Sprintf(\"%s--%s--%d\", b.Cluster.Name, etcdCluster.Name, 0),\n\t\t\t\t// TODO: Support multiple control-plane nodes (will be interesting!)\n\t\t\t\tIP: []string{\"node0\" + \".\" + etcdCluster.Name + \".\" + b.Cluster.Name},\n\t\t\t})\n\t\t\tb, err := json.Marshal(staticConfig)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"building static config: %w\", err)\n\t\t\t}\n\t\t\tconfig.StaticConfig = string(b)\n\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"CloudProvider %q not supported with etcd-manager\", b.Cluster.GetCloudProvider())\n\t\t}\n\t}\n\n\targs, err := flagbuilder.BuildFlagsList(config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t{\n\t\tcontainer.Command = []string{\"/go-runner\"}\n\t\tcontainer.Args = []string{\n\t\t\t\"--log-file=/var/log/etcd.log\",\n\t\t\t\"--also-stdout\",","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/components/etcdmanager/model.go#L527-L563","documentation":"During etcd-manager pod construction for bare-metal (\"metal\") clusters, kOps builds a StaticConfig struct (fixed etcd member list) and JSON-serializes it. If json.Marshal fails, the error is wrapped as \"building static config: %w\". Marshal of this in-memory struct essentially only fails if something injected unsupported types (e.g. non-serializable values via NaN floats), so this is a defensive internal error rather than a user-facing config problem.","triggerScenarios":"Running `kops create cluster`/`kops update cluster --target terraform|direct` on a cluster with cloudProvider \"metal\", causing buildPod (called from buildManifest) to reach the CloudProviderMetal case and call json.Marshal(staticConfig); only fails if marshal returns an error, which for this fixed struct is practically unreachable.","commonSituations":"Seen in bug reports about bare-metal etcd-manager clusters; almost always indicates a kOps internal bug or a corrupted in-memory cluster spec rather than a user mistake.","solutions":["Upgrade kOps to the latest patch release, since the wrapped marshal error points to an internal defect","Inspect the wrapped inner error (%w) for the exact json.UnsupportedType/Value message to identify which field broke serialization","File a kOps issue with the full cluster spec and kOps version if it reproduces on the latest release"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Go caller of buildPod\npod, err := buildPod(ctx, b, etcdCluster)\nif err != nil {\n    var marshalErr *json.UnsupportedTypeError\n    if errors.As(err, &marshalErr) {\n        klog.Errorf(\"static config marshal failed: %v\", marshalErr)\n    }\n    return fmt.Errorf(\"etcd-manager pod build failed: %w\", err)\n}","preventionTips":["Keep kOps updated; this code path is internal and fixed upstream","Avoid injecting dynamic/unsupported values into StaticConfig in forks","Include the wrapped inner error in bug reports"],"tags":["etcd-manager","bare-metal","json-marshal"],"backgroundTag":"static-config-marshal-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}