benbjohnson/litestream · error
oss: list objects page: %w
Error message
oss: list objects page: %w
What it means
DeleteAll pages through ListObjectsV2 to enumerate all objects under the replica path before deleting them. A paginator.NextPage failure is wrapped as 'list objects page'. This precedes any deletion and usually indicates connectivity, auth, or bucket-state problems.
Source
Thrown at oss/replica_client.go:354
func (c *ReplicaClient) DeleteAll(ctx context.Context) error {
if err := c.Init(ctx); err != nil {
return err
}
var objects []oss.DeleteObject
// Create paginator for listing objects
prefix := c.Path + "/"
paginator := c.client.NewListObjectsV2Paginator(&oss.ListObjectsV2Request{
Bucket: oss.Ptr(c.Bucket),
Prefix: oss.Ptr(prefix),
})
// Iterate through all pages
for paginator.HasNext() {
page, err := paginator.NextPage(ctx)
if err != nil {
return fmt.Errorf("oss: list objects page: %w", err)
}
// Collect object identifiers
for _, obj := range page.Contents {
if obj.Key != nil {
objects = append(objects, oss.DeleteObject{Key: obj.Key})
}
}
}
// Delete all collected objects in batches
for len(objects) > 0 {
n := min(len(objects), MaxKeys)
batch := objects[:n]
request := &oss.DeleteMultipleObjectsRequest{
Bucket: oss.Ptr(c.Bucket),
Objects: batch,View on GitHub (pinned to 4ed7a308f6)
Solutions
- Grant oss:ListObjects (List) permission to the RAM role.
- Verify the bucket exists and endpoint/region are correct.
- Retry; pagination is resumable via continuation tokens and transient failures are safe to reattempt.
- Check network path stability if the failure occurs on later pages of a large object set.
Example fix
// before (RAM policy)
{"Effect":"Allow","Action":["oss:PutObject","oss:GetObject","oss:DeleteObjects"],"Resource":"acs:oss:*:*:my-bucket/*"}
// after
{"Effect":"Allow","Action":["oss:PutObject","oss:GetObject","oss:ListObjects","oss:DeleteObjects"],"Resource":"acs:oss:*:*:my-bucket/*"} Defensive patterns
Strategy: retry
Validate before calling
if _, err := client.ListLTXFiles(ctx); err != nil { /* list permission broken; fix before running DeleteAll */ } Try / catch
err := client.DeleteAll(ctx)
if err != nil {
if isTransient(err) { time.Sleep(backoff); return client.DeleteAll(ctx) }
return fmt.Errorf("delete all: %w", err)
} Prevention
- Grant oss:ListObjects in addition to read/write permissions.
- Run DeleteAll over a reliable network; large buckets paginate many times.
- Confirm the bucket exists before destructive operations.
When it happens
Trigger: DeleteAll (e.g. dropping a replica or 'litestream reset' cleanup) iterating listing pages when the token-based pagination breaks due to network error, AccessDenied on oss:ListObjects, or a removed bucket.
Common situations: RAM policy missing oss:ListObjects; bucket deleted externally mid-operation; long-running pagination across an unstable VPN/corporate network.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- abs: cannot list blobs: %w
- close l1 iterator: %w
- oss: get object %s: %w
- oss: upload to %s: %w
- oss: delete batch of %d objects: %w
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/4d2cc28dfc744293.
Report an issue: GitHub.