{"record":{"id":"e5536f18b959e283","repo":"kubernetes/kops","slug":"kubernetespath-readdir-not-supported","errorCode":null,"errorMessage":"KubernetesPath::ReadDir not supported","messagePattern":"KubernetesPath::ReadDir not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/k8sfs.go","lineNumber":117,"sourceCode":"}\n\n// ReadFile implements Path::ReadFile\nfunc (p *KubernetesPath) ReadFile(ctx context.Context) ([]byte, error) {\n\tvar b bytes.Buffer\n\t_, err := p.WriteTo(&b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b.Bytes(), nil\n}\n\n// WriteTo implements io.WriterTo\nfunc (p *KubernetesPath) WriteTo(out io.Writer) (int64, error) {\n\treturn 0, fmt.Errorf(\"KubernetesPath::WriteTo not supported\")\n}\n\nfunc (p *KubernetesPath) ReadDir() ([]Path, error) {\n\treturn nil, fmt.Errorf(\"KubernetesPath::ReadDir not supported\")\n}\n\nfunc (p *KubernetesPath) ReadTree(ctx context.Context) ([]Path, error) {\n\treturn nil, fmt.Errorf(\"KubernetesPath::ReadTree not supported\")\n}\n\nfunc (p *KubernetesPath) Base() string {\n\treturn path.Base(p.key)\n}\n\nfunc (p *KubernetesPath) PreferredHash() (*hashing.Hash, error) {\n\treturn p.Hash(hashing.HashAlgorithmMD5)\n}\n\nfunc (p *KubernetesPath) Hash(a hashing.HashAlgorithm) (*hashing.Hash, error) {\n\treturn nil, fmt.Errorf(\"KubernetesPath::Hash not supported\")\n}\n","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/k8sfs.go#L99-L135","documentation":"Hard guard: directory listing is meaningless for k8s:// paths, so KubernetesPath.ReadDir always returns this error. The Kubernetes API stores objects flat by key with no directory hierarchy, so there is nothing to enumerate as children; generic VFS code that lists paths must special-case this scheme or avoid it.","triggerScenarios":"Thrown at util/pkg/vfs/k8sfs.go:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["List objects with the Kubernetes API using label selectors instead of path listing","Skip ReadDir for k8s:// paths by checking the path scheme upfront"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}