kubernetes/kops · error

error listing tree %s: %v

Error message

error listing tree %s: %v

What it means

Returned by GSPath.ReadTree when a recursive object listing (no delimiter) fails on it.Next() with an error other than not-found (which is mapped to os.ErrNotExist). It means the GCS list API errored partway through enumerating all objects under the prefix — usually permissions, a dropped connection, or a transient API failure — so the tree of child paths cannot be assembled.

Source

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

		}

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

		var paths []Path
		it := client.Bucket(p.bucket).Objects(ctx, &storage.Query{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 tree %s: %v", p, err)
			}
			child := &GSPath{
				vfsContext: p.vfsContext,
				bucket:     p.bucket,
				key:        o.Name,
				md5Hash:    base64.StdEncoding.EncodeToString(o.MD5),
			}
			paths = append(paths, child)
		}
		ret = paths
		return true, nil
	})
	if err != nil {
		return nil, err
	} else if done {
		return ret, nil
	} else {
		// Shouldn't happen - we always return a non-nil error with false

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Verify storage.objects.list permission on the bucket for the configured credentials
  2. Retry the listing with backoff; large trees page through many list calls and transient failures are common
  3. Narrow the prefix if the result set exceeds list limits or times out
Defensive patterns

Strategy: retry

When it happens

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