{"record":{"id":"47659eb898c308ac","repo":"kubernetes/kops","slug":"converting-cluster-object-w","errorCode":null,"errorMessage":"converting cluster object: %w","messagePattern":"converting cluster object: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/controllers/clusterapi/cluster_controller.go","lineNumber":173,"sourceCode":"\n\tu := &unstructured.Unstructured{Object: obj}\n\n\t// setOwnerRef(u, s.Cluster)\n\n\tif err := s.ssa(ctx, kube, u); err != nil {\n\t\treturn fmt.Errorf(\"applying GCPCluster object to cluster: %w\", err)\n\t}\n\n\ts.capiInfra = u\n\treturn nil\n}\n\nfunc (s *clusterScope) findSystemEndpoints(ctx context.Context) ([]capikops.SystemEndpoint, error) {\n\tcluster := s.Cluster\n\n\tclusterInternal := &kops.Cluster{}\n\tif err := kopscodecs.Scheme.Convert(cluster, clusterInternal, nil); err != nil {\n\t\treturn nil, fmt.Errorf(\"converting cluster object: %w\", err)\n\t}\n\n\tcloud, err := cloudup.BuildCloud(clusterInternal)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO: Sync with BuildKubecfg\n\n\tingresses, err := cloud.GetApiIngressStatus(clusterInternal)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting ingress status: %v\", err)\n\t}\n\n\tvar targets []capikops.SystemEndpoint\n\n\tfor _, ingress := range ingresses {\n\t\tvar target capikops.SystemEndpoint","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/controllers/clusterapi/cluster_controller.go#L155-L191","documentation":"findSystemEndpoints converts the kops Cluster API object (kops.Cluster from internalclientset) into the internal kops.Cluster type using the kops codec scheme, wrapping conversion failures. A failure means the external Cluster object contains fields/data the conversion scheme cannot translate.","triggerScenarios":"clusterScope.findSystemEndpoints() called from createKopsControlPlane when kopscodecs.Scheme.Convert(cluster, clusterInternal, nil) errors.","commonSituations":"Version skew between the CAPI controller's kops API libraries and the cluster spec's stored API version; invalid or out-of-range field values that fail conversion validation; hand-edited manifests with malformed fields.","solutions":["Ensure the CAPI controller is built against the kops API version matching the cluster manifest","Fix malformed fields reported by the conversion error","Recreate/normalize the Cluster object through the API server (apply via kOps tooling) rather than hand-editing"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if cluster.APIVersion == \"\" || cluster.Kind == \"\" {\n\treturn fmt.Errorf(\"cluster object missing apiVersion/kind; cannot convert\")\n}","typeGuard":null,"tryCatchPattern":"clusterInternal := &kops.Cluster{}\nif err := kopscodecs.Scheme.Convert(cluster, clusterInternal, nil); err != nil {\n\treturn nil, fmt.Errorf(\"converting cluster object: %w\", err)\n}","preventionTips":["Keep controller's kops API libraries in sync with the cluster manifest version","Avoid hand-editing stored Cluster objects; apply via supported tooling","Check the conversion error's field path to fix the offending spec field"],"tags":["clusterapi","conversion","serialization"],"backgroundTag":"api-object-conversion-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"}