kubernetes/kops · error

KubernetesPath::ReadDir not supported

Error message

KubernetesPath::ReadDir not supported

What it means

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.

Source

Thrown at util/pkg/vfs/k8sfs.go:117

}

// ReadFile implements Path::ReadFile
func (p *KubernetesPath) ReadFile(ctx context.Context) ([]byte, error) {
	var b bytes.Buffer
	_, err := p.WriteTo(&b)
	if err != nil {
		return nil, err
	}
	return b.Bytes(), nil
}

// WriteTo implements io.WriterTo
func (p *KubernetesPath) WriteTo(out io.Writer) (int64, error) {
	return 0, fmt.Errorf("KubernetesPath::WriteTo not supported")
}

func (p *KubernetesPath) ReadDir() ([]Path, error) {
	return nil, fmt.Errorf("KubernetesPath::ReadDir not supported")
}

func (p *KubernetesPath) ReadTree(ctx context.Context) ([]Path, error) {
	return nil, fmt.Errorf("KubernetesPath::ReadTree not supported")
}

func (p *KubernetesPath) Base() string {
	return path.Base(p.key)
}

func (p *KubernetesPath) PreferredHash() (*hashing.Hash, error) {
	return p.Hash(hashing.HashAlgorithmMD5)
}

func (p *KubernetesPath) Hash(a hashing.HashAlgorithm) (*hashing.Hash, error) {
	return nil, fmt.Errorf("KubernetesPath::Hash not supported")
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. List objects with the Kubernetes API using label selectors instead of path listing
  2. Skip ReadDir for k8s:// paths by checking the path scheme upfront
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at util/pkg/vfs/k8sfs.go:117 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/e5536f18b959e283. Report an issue: GitHub.