benbjohnson/litestream · error

abs: cannot start new reader for %q: %w

Error message

abs: cannot start new reader for %q: %w

What it means

abs.OpenLTXFile's DownloadStream call failed for a reason other than not-exists while opening an LTX file for ranged read. Typically a network failure, authorization error, or an invalid range request against Azure Blob Storage.

Source

Thrown at abs/replica_client.go:283

// OpenLTXFile returns a reader for an LTX file.
// Returns os.ErrNotExist if no matching min/max TXID is not found.
func (c *ReplicaClient) OpenLTXFile(ctx context.Context, level int, minTXID, maxTXID ltx.TXID, offset, size int64) (io.ReadCloser, error) {
	if err := c.Init(ctx); err != nil {
		return nil, err
	}

	key := litestream.LTXFilePath(c.Path, level, minTXID, maxTXID)
	resp, err := c.client.DownloadStream(ctx, c.Bucket, key, &azblob.DownloadStreamOptions{
		Range: blob.HTTPRange{
			Offset: offset,
			Count:  size,
		},
	})

	if isNotExists(err) {
		return nil, os.ErrNotExist
	} else if err != nil {
		return nil, fmt.Errorf("abs: cannot start new reader for %q: %w", key, err)
	}

	internal.OperationTotalCounterVec.WithLabelValues(ReplicaClientType, "GET").Inc()
	internal.OperationBytesCounterVec.WithLabelValues(ReplicaClientType, "GET").Add(float64(*resp.ContentLength))

	return resp.Body, nil
}

// DeleteLTXFiles deletes LTX files.
func (c *ReplicaClient) DeleteLTXFiles(ctx context.Context, a []*ltx.FileInfo) error {
	if err := c.Init(ctx); err != nil {
		return err
	}

	for _, info := range a {
		key := litestream.LTXFilePath(c.Path, info.Level, info.MinTXID, info.MaxTXID)

		c.logger.Debug("deleting ltx file", "level", info.Level, "minTXID", info.MinTXID, "maxTXID", info.MaxTXID, "key", key)

View on GitHub (pinned to 4ed7a308f6)

Solutions

  1. Check the wrapped azblob error code to distinguish auth from network issues
  2. Verify credential permissions include read (Storage Blob Data Reader)
  3. Retry the operation; transient Azure errors are retried on subsequent sync/restore attempts
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at abs/replica_client.go:283 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/d797d40ce36edf84. Report an issue: GitHub.