{"record":{"id":"d2cc9ecf51840c0d","repo":"kubernetes/kops","slug":"cluster-patch-not-implemented-for-vfs-store","errorCode":null,"errorMessage":"cluster Patch not implemented for vfs store","messagePattern":"cluster Patch not implemented for vfs store","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/client/simple/vfsclientset/cluster.go","lineNumber":231,"sourceCode":"\t}\n\n\treturn c, nil\n}\n\nfunc (r *ClusterVFS) Delete(name string, options *metav1.DeleteOptions) error {\n\treturn fmt.Errorf(\"cluster Delete not implemented for vfs store\")\n}\n\nfunc (r *ClusterVFS) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\treturn fmt.Errorf(\"cluster DeleteCollection not implemented for vfs store\")\n}\n\nfunc (r *ClusterVFS) Watch(opts metav1.ListOptions) (watch.Interface, error) {\n\treturn nil, fmt.Errorf(\"cluster Watch not implemented for vfs store\")\n}\n\nfunc (r *ClusterVFS) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *api.Cluster, err error) {\n\treturn nil, fmt.Errorf(\"cluster Patch not implemented for vfs store\")\n}\n","sourceCodeStart":213,"sourceCodeEnd":233,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/client/simple/vfsclientset/cluster.go#L213-L233","documentation":"A Patch against the Cluster object was requested through the VFS-backed clientset, which has no compare-and-swap semantics; only the REST (API-server) clientset implements Patch, so this is a hard capability gap of the vfs store, not a data or permissions error.","triggerScenarios":"Calling ClusterVFS.Patch(name, patchType, data, subresources...) against a vfs-backed clientset.","commonSituations":"Code using generic clientset patch helpers (StrategicMerge/JSON patch) ported to kops vfs store; automation applying small updates to Cluster specs.","solutions":["Read the object with Get/Find, mutate the struct in Go, then write it back with Update.","Use the API-server (grpc) kops clientset if patch semantics are needed.","Implement ClusterVFS.Patch by decoding the patch and applying it to the stored object if you own the fork."],"exampleFix":"// before\n_, err := clusterClient.Patch(ctx, \"mycluster\", types.StrategicMergePatchType, data, metav1.PatchOptions{})\n// after\nc, err := clusterClient.Get(ctx, \"mycluster\", metav1.GetOptions{})\nif err != nil { return err }\nc.Spec.KubernetesVersion = \"1.29.0\"\n_, err = clusterClient.Update(ctx, c, metav1.UpdateOptions{})","handlingStrategy":"fallback","validationCode":"if _, ok := clusterClient.(interface{ Patch(string, types.PatchType, []byte, ...string) (*kops.Cluster, error) }); !ok {\n    return errors.New(\"patch unsupported on vfs store; use Get+Update\")\n}","typeGuard":"func supportsPatch(c interface{}) bool {\n    _, ok := c.(interface{ Patch(string, types.PatchType, []byte, ...string) (*kops.Cluster, error) })\n    return ok\n}","tryCatchPattern":"_, err := client.Patch(name, pt, data)\nif err != nil && strings.Contains(err.Error(), \"not implemented for vfs store\") {\n    // fall back to Get, mutate, Update\n}","preventionTips":["Use read-modify-write (Get + Update) instead of Patch for vfs-backed stores.","Keep patch-based code paths behind an interface check for the API-server clientset."],"tags":["vfs","unimplemented","patch","clientset"],"backgroundTag":"method-not-implemented","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"}