{"record":{"id":"fcb1989837cca48f","repo":"VictoriaMetrics/VictoriaMetrics","slug":"cannot-read-q-at-s-remote-path-q-w-fcb198","errorCode":null,"errorMessage":"cannot read %q at %s (remote path %q): %w","messagePattern":"cannot read %q at (.+?) \\(remote path %q\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/backup/s3remote/s3.go","lineNumber":578,"sourceCode":"\t}\n\treturn true, nil\n}\n\n// ReadFile returns the content of filePath at fs.\nfunc (fs *FS) ReadFile(filePath string) ([]byte, error) {\n\tp := path.Join(fs.Dir, filePath)\n\tinput := &s3.GetObjectInput{\n\t\tBucket: aws.String(fs.Bucket),\n\t\tKey:    aws.String(p),\n\t}\n\to, err := fs.s3.GetObject(fs.ctx, input)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot open %q at %s (remote path %q): %w\", filePath, fs, p, err)\n\t}\n\tdefer o.Body.Close()\n\tb, err := io.ReadAll(o.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot read %q at %s (remote path %q): %w\", filePath, fs, p, err)\n\t}\n\treturn b, nil\n}\n\nfunc (fs *FS) path(p common.Part) string {\n\treturn p.RemotePath(fs.Dir)\n}\n\ntype statReader struct {\n\tr    io.Reader\n\tsize int64\n}\n\nfunc (sr *statReader) Read(p []byte) (int, error) {\n\tn, err := sr.r.Read(p)\n\tsr.size += int64(n)\n\treturn n, err\n}","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/VictoriaMetrics/VictoriaMetrics/blob/5079fb58f1e8e62113f90c945ad71586c797d770/lib/backup/s3remote/s3.go#L560-L596","documentation":"The object was opened, but io.ReadAll on the response body failed while downloading the content. The object exists, yet its bytes could not be fully read (connection interrupted, checksum mismatch, decode error).","triggerScenarios":"io.ReadAll(o.Body) returns non-nil mid-stream: connection reset while streaming a large part, TLS handshake failure mid-transfer, timeouts on slow links, or S3 returning a truncated body.","commonSituations":"Large backups over unstable networks; proxy/load-balancer idle timeouts killing long streams; clients with very short read timeouts.","solutions":["Retry the read; transient stream interruptions are common","Increase client read timeouts and disable aggressive idle cutoffs","Avoid proxies that buffer/kill long responses or use a stable VPC endpoint","If persistent, verify object integrity (ETag/checksum) — the stored object may be corrupt"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// check object size before reading to anticipate long transfers\nhead, err := s3.HeadObject(ctx, &s3.HeadObjectInput{Bucket: aws.String(bucket), Key: aws.String(key)})\nif err != nil { return err }\n// ensure client read timeout comfortably exceeds size/bandwidth","typeGuard":null,"tryCatchPattern":"b, err := fs.ReadFile(filePath)\nif err != nil && strings.Contains(err.Error(), \"cannot read\") {\n\t// transient stream failure: retry with backoff, verify ETag after\n}","preventionTips":["Set generous read/idle timeouts for large object downloads","Avoid proxies with aggressive idle cutoffs on long streams","Verify object integrity via ETag/checksum after download","Retry transient body-read failures; they are common on flaky links"],"tags":["s3","read","stream","network","aws-sdk"],"backgroundTag":"s3-body-read-failed","analyzedSha":"5079fb58f1e8e62113f90c945ad71586c797d770","analyzedAt":"2026-09-03T18:10:26.153Z","contentChangedAt":"2026-09-03T18:10:26.153Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}