{"record":{"id":"e8a464411c5b48aa","repo":"kubernetes/kops","slug":"unhandled-kind-q-in-q","errorCode":null,"errorMessage":"unhandled kind %q in %q","messagePattern":"unhandled kind %q in %q","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/replace.go","lineNumber":223,"sourceCode":"\n\t\t\t\tcluster, err := clientset.GetCluster(ctx, clusterName)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tsshCredentialStore, err := clientset.SSHCredentialStore(cluster)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tsshKeyArr := []byte(v.Spec.PublicKey)\n\t\t\t\terr = sshCredentialStore.AddSSHPublicKey(ctx, sshKeyArr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error replacing SSHCredential: %v\", err)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tklog.V(2).Infof(\"Type of object was %T\", v)\n\t\t\t\treturn fmt.Errorf(\"unhandled kind %q in %q\", gvk, f)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":205,"sourceCodeEnd":230,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/replace.go#L205-L230","documentation":"`kops replace` only supports a fixed set of kinds: Cluster, InstanceGroup, and SSHCredential. When the decoded object's GroupVersionKind is none of these, the command logs the Go type at V(2) and returns this error naming the unhandled gvk and the source file it was read from.","triggerScenarios":"Replacing a manifest containing a kind outside the supported set — e.g. a KubernetesCluster addon manifest, keyset, secrets, or a plain Kubernetes object — via `kops replace -f file.yaml`.","commonSituations":"Feeding an `kops update`/`create -f` bundle (multiple kinds) into replace; typos in `kind:`; using manifests meant for kubectl against kops; older/newer kops manifests with kinds unsupported by this version.","solutions":["Split the bundle and only pass Cluster, InstanceGroup, or SSHCredential manifests to `kops replace`; use `kops create -f` / `kops update cluster` for other resources.","Check `kind:` spelling and the apiVersion in the manifest.","Upgrade/downgrade kops if the kind exists in another kops version.","Set KOPS_LOG_LEVEL=2 (klog V(2)) to see the Go type that failed to dispatch."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"func isReplaceableKind(manifest []byte) bool {\n    var meta struct { Kind string `json:\"kind\"` }\n    if err := json.Unmarshal(manifest, &meta); err != nil { return false }\n    switch meta.Kind {\n    case \"Cluster\", \"InstanceGroup\", \"SSHCredential\":\n        return true\n    }\n    return false\n}","typeGuard":"func isReplaceableKind(gvk schema.GroupVersionKind) bool {\n    return gvk.GroupKind().Kind == \"Cluster\" ||\n        gvk.GroupKind().Kind == \"InstanceGroup\" ||\n        gvk.GroupKind().Kind == \"SSHCredential\"\n}","tryCatchPattern":null,"preventionTips":["Split multi-kind bundles; route Cluster/IG/SSHCredential to kops replace and the rest to kubectl/kops create","Pin the `kind:` and `apiVersion:` fields and lint them","Keep manifest tooling and kops versions aligned"],"tags":["kops","replace","unsupported-kind","manifest"],"backgroundTag":"unsupported-resource-kind","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"}