benbjohnson/litestream · error
failed to list all objects: %w
Error message
failed to list all objects: %w
What it means
DeleteAll's initial List of the NATS object store failed with an error other than the benign 'no objects found' (empty bucket) case. Connection, auth, or JetStream state problem prevented enumeration for deletion.
Source
Thrown at nats/replica_client.go:470
}
return nil
}
// DeleteAll deletes all files in the object store.
func (c *ReplicaClient) DeleteAll(ctx context.Context) error {
if err := c.Init(ctx); err != nil {
return err
}
// List all objects in the bucket
objectList, err := c.objectStore.List(ctx)
if err != nil {
// NATS returns "no objects found" when bucket is empty, treat as empty list
if strings.Contains(err.Error(), "no objects found") {
objectList = nil // Empty list, nothing to delete
} else {
return fmt.Errorf("failed to list all objects: %w", err)
}
}
for _, objInfo := range objectList {
if err := c.objectStore.Delete(ctx, objInfo.Name); err != nil {
if !isNotFoundError(err) {
return fmt.Errorf("failed to delete object %s: %w", objInfo.Name, err)
}
}
internal.OperationTotalCounterVec.WithLabelValues(ReplicaClientType, "DELETE").Inc()
}
return nil
}
// isNotFoundError checks if the error is a "not found" error.
func isNotFoundError(err error) bool {
return err != nil && (errors.Is(err, jetstream.ErrObjectNotFound) || strings.Contains(err.Error(), "not found"))View on GitHub (pinned to 4ed7a308f6)
Solutions
- Check NATS connectivity and credentials
- Verify the bucket/stream exists and is not in an error state
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at nats/replica_client.go:470 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/001b84128bb6038c.
Report an issue: GitHub.