overleaf/overleaf · error · ReadError
error reading file from S3
Error message
error reading file from S3
What it means
Thrown by S3Persistor.getObjectStream when the GetObjectCommand fails (missing key, no read permission, or SDK/network error); the abort controller is triggered to cancel any partial transfer and the raw error is wrapped into a ReadError with bucket/key context.
Source
Thrown at libraries/object-persistor/src/S3Persistor.js:251
}
const observer = new PersistorHelper.ObserverStream({
metric: 's3.ingress', // ingress from S3 to us
bucket: bucketName,
})
const abortController = new AbortController()
let stream, contentEncoding
try {
const { Body, ContentEncoding } = await this._getClientForBucket(
bucketName
).send(new GetObjectCommand(params), {
abortSignal: abortController.signal,
})
stream = Body
contentEncoding = ContentEncoding
} catch (err) {
abortController.abort()
throw PersistorHelper.wrapError(
err,
'error reading file from S3',
{ bucketName, key, opts },
ReadError
)
}
// Return a PassThrough stream with a minimal interface. It will buffer until the caller starts reading. It will emit errors from the source stream (Stream.pipeline passes errors along).
const pass = new PassThrough()
const transformer = []
if (contentEncoding === 'gzip' && opts.autoGunzip) {
transformer.push(zlib.createGunzip())
}
// @ts-ignore stream (Body) can be undefined in GetObjectCommand
pipeline(stream, observer, ...transformer, pass, err => {
if (err) {
abortController.abort()
}
})View on GitHub (pinned to 28ad3b03b7)
Solutions
- Treat wrapped NotFoundError (S3 NoSuchKey) as a missing object: regenerate or re-upload it
- Verify bucket read permissions and the exact key including prefixes
- Check S3/network health and SDK credentials
- Retry transient S3 5xx or timeout failures with backoff
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at libraries/object-persistor/src/S3Persistor.js:251 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of overleaf/overleaf@28ad3b03b7 (2026-09-03).
Data as JSON: /api/errors/fca1cadbb7a5063f.
Report an issue: GitHub.