kubernetes/kops · error

error listing %s: %v

Error message

error listing %s: %v

What it means

Returned by GSPath.ReadDir when iterating bucket object listings (storage.Query with Delimiter "/") and it.Next() fails with something other than not-found (not-found is translated to os.ErrNotExist). It indicates the GCS list-objects API call failed — bad credentials, no storage.objects.list permission, or a transient API error — while enumerating the pseudo-directory's children.

Source

Thrown at util/pkg/vfs/gsfs.go:332

		}

		client, err := p.getStorageClient(ctx)
		if err != nil {
			return false, err
		}

		var paths []Path
		it := client.Bucket(p.bucket).Objects(ctx, &storage.Query{Delimiter: "/", Prefix: prefix})
		for {
			o, err := it.Next()
			if err == iterator.Done {
				break
			}
			if err != nil {
				if isGCSNotFound(err) {
					return true, os.ErrNotExist
				}
				return false, fmt.Errorf("error listing %s: %v", p, err)
			}
			if o.Prefix != "" {
				// Synthetic directory entry, not an object
				continue
			}
			child := &GSPath{
				vfsContext: p.vfsContext,
				bucket:     p.bucket,
				key:        o.Name,
				md5Hash:    base64.StdEncoding.EncodeToString(o.MD5),
			}
			paths = append(paths, child)
		}
		klog.V(8).Infof("Listed files in %v: %v", p, paths)
		ret = paths
		return true, nil
	})
	if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify the authenticated identity has storage.objects.list permission on the bucket
  2. Check that the bucket exists and the project is accessible with the configured credentials
  3. Retry with backoff for transient Google API errors (5xx, rate limits)
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at util/pkg/vfs/gsfs.go:332 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/7a51e0791236e1f2. Report an issue: GitHub.