{"record":{"id":"a865ce0b300fc95d","repo":"kubernetes/kops","slug":"resourceversion-not-supported-in-clustervfs-get","errorCode":null,"errorMessage":"ResourceVersion not supported in ClusterVFS::Get","messagePattern":"ResourceVersion not supported in ClusterVFS::Get","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/client/simple/vfsclientset/cluster.go","lineNumber":52,"sourceCode":"\tapi \"k8s.io/kops/pkg/apis/kops\"\n\t\"k8s.io/kops/pkg/apis/kops/registry\"\n\t\"k8s.io/kops/pkg/apis/kops/validation\"\n\t\"k8s.io/kops/util/pkg/vfs\"\n)\n\ntype ClusterVFS struct {\n\tVFSClientBase\n}\n\nfunc newClusterVFS(vfsContext *vfs.VFSContext, basePath vfs.Path) *ClusterVFS {\n\tc := &ClusterVFS{}\n\tc.Init(\"Cluster\", vfsContext, basePath, StoreVersion)\n\treturn c\n}\n\nfunc (c *ClusterVFS) Get(ctx context.Context, name string, options metav1.GetOptions) (*api.Cluster, error) {\n\tif options.ResourceVersion != \"\" {\n\t\treturn nil, fmt.Errorf(\"ResourceVersion not supported in ClusterVFS::Get\")\n\t}\n\to, err := c.find(ctx, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif o == nil {\n\t\treturn nil, errors.NewNotFound(schema.GroupResource{Group: api.GroupName, Resource: \"Cluster\"}, name)\n\t}\n\treturn o, nil\n}\n\n// Deprecated, but we need this for now..\nfunc (c *ClusterVFS) configBase(clusterName string) (vfs.Path, error) {\n\tif clusterName == \"\" {\n\t\treturn nil, fmt.Errorf(\"clusterName is required\")\n\t}\n\tconfigPath := c.basePath.Join(clusterName)\n\treturn configPath, nil","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/client/simple/vfsclientset/cluster.go#L34-L70","documentation":"ClusterVFS::Get is the VFS-backed implementation of the cluster store's Get. It does not support the ResourceVersion field of metav1.GetOptions, so any caller passing a non-empty ResourceVersion gets this error before any I/O happens. ResourceVersion semantics (watch/optimistic-concurrency reads) are a real API-server feature the VFS backend does not emulate.","triggerScenarios":"Calling ClusterVFS.Get(ctx, name, metav1.GetOptions{ResourceVersion: \"...\"}) with any non-empty ResourceVersion string, e.g. copying GetOptions from a real clientset call or from generated client code.","commonSituations":"Code refactored from a kubernetes/client-go typed client to the simple VFS clientset; copied options structs that default-populate ResourceVersion; tests that set ResourceVersion to '0' or a real version string.","solutions":["Pass a zero-value metav1.GetOptions{} (no ResourceVersion) to ClusterVFS.Get","Strip or reset options.ResourceVersion before calling Get when reusing options from another client","If you need ResourceVersion semantics, use a real API-server clientset instead of the VFS store"],"exampleFix":"// before\no, err := clusterVFS.Get(ctx, \"prod.example.com\", metav1.GetOptions{ResourceVersion: \"12345\"})\n// after\no, err := clusterVFS.Get(ctx, \"prod.example.com\", metav1.GetOptions{})","handlingStrategy":"validation","validationCode":"if options.ResourceVersion != \"\" {\n\treturn fmt.Errorf(\"vfs clientset does not support ResourceVersion in Get\")\n}\ncluster, err := clusterVFS.Get(ctx, name, options)","typeGuard":"func getOptionsSafeForVFS(o metav1.GetOptions) bool {\n\treturn o.ResourceVersion == \"\"\n}","tryCatchPattern":"cluster, err := clusterVFS.Get(ctx, name, metav1.GetOptions{})\nif err != nil {\n\tif strings.Contains(err.Error(), \"ResourceVersion not supported\") {\n\t\t// retry with zero-value options\n\t\tcluster, err = clusterVFS.Get(ctx, name, metav1.GetOptions{})\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n}","preventionTips":["Always pass metav1.GetOptions{} to VFS-backed stores","Never copy GetOptions from client-go clients into the vfs clientset","Add a unit test asserting Get works with zero-value options"],"tags":["go","vfs","api-options"],"backgroundTag":"unsupported-resource-version","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"}