kubernetes/kops · error
error reading %s: %v
Error message
error reading %s: %v
What it means
Returned by GSPath.WriteToWithContext when opening a GCS object reader fails for a reason other than not-found (not-found is mapped to os.ErrNotExist first). It means the object exists check/reader creation errored — typically permission denied on the bucket, transient API failure, or an invalid bucket/key — while streaming the object's contents to the caller.
Source
Thrown at util/pkg/vfs/gsfs.go:298
ctx := context.TODO()
return p.WriteToWithContext(ctx, out)
}
// WriteToWithContext implements io.WriterTo, but adds a context
func (p *GSPath) WriteToWithContext(ctx context.Context, out io.Writer) (int64, error) {
klog.V(4).Infof("Reading file %q", p)
client, err := p.getStorageClient(ctx)
if err != nil {
return 0, err
}
r, err := client.Bucket(p.bucket).Object(p.key).NewReader(ctx)
if err != nil {
if isGCSNotFound(err) {
return 0, os.ErrNotExist
}
return 0, fmt.Errorf("error reading %s: %v", p, err)
}
defer r.Close()
return io.Copy(out, r)
}
// ReadDir implements Path::ReadDir
func (p *GSPath) ReadDir() ([]Path, error) {
ctx := context.TODO()
var ret []Path
done, err := RetryWithBackoff(gcsReadBackoff, func() (bool, error) {
prefix := p.key
if !strings.HasSuffix(prefix, "/") {
prefix += "/"
}
client, err := p.getStorageClient(ctx)View on GitHub (pinned to 4c8573c808)
Solutions
- Inspect credentials and verify the account has storage.objects.get permission on the bucket
- Confirm the bucket name and object key are correct and the bucket is in an accessible project
- Retry on transient Google API errors; the GCS SDK surfaces 5xx and rate-limit errors that clear on backoff
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at util/pkg/vfs/gsfs.go:298 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/9e94b2b39923fd02.
Report an issue: GitHub.