kopia/kopia · error

could not get versioning info for

Error message

could not get versioning info for %s

What it means

Wrapper in S3 IsVersioned: the GetBucketVersioning API call failed, so kopia cannot determine whether bucket versioning is enabled — required before using retention/versioned features; the bucket name is interpolated into the message.

Solutions

  1. Grant s3:GetBucketVersioning to the credentials in use
  2. Verify bucket exists and endpoint/region are correct
  3. Check network connectivity to the S3 endpoint
  4. Inspect errors.Cause(err) for the S3 error code (NoSuchBucket, AccessDenied, etc.)

Example fix

// before
{"Version":"2012-10-17","Statement":[{"Effect":"Deny","Action":"s3:GetBucketVersioning","Resource":"*"}]}
// after
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["s3:GetBucketVersioning","s3:PutObjectRetention"],"Resource":"*"}]}
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := svc.GetBucketVersioning(&s3.GetBucketVersioningInput{Bucket: aws.String(bucketName)}); err != nil {
    return fmt.Errorf("cannot read versioning status for %s: %w", bucketName, err)
}

Try / catch

versioned, err := store.(interface{ IsVersioned(context.Context) (bool, error) }).IsVersioned(ctx)
if err != nil {
    if strings.Contains(err.Error(), "AccessDenied") { /* fix IAM: s3:GetBucketVersioning */ }
    return err
}

Prevention

When it happens

Trigger: Calling IsVersioned (used before PutBlob with retention/version checks) when the API call fails: no s3:GetBucketVersioning permission, bucket does not exist, wrong region endpoint, or network error.

Common situations: IAM policy missing GetBucketVersioning; bucket name typo; using an endpoint pointing to the wrong region; MinIO deployments without versioning support returning errors.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of kopia/kopia@82495e54b5 (2026-09-07). Data as JSON: /api/errors/a8733d9dfefe3050. Report an issue: GitHub.

Appendix: source

Thrown at repo/blob/s3/s3_versioned.go:33

	blob.Metadata

	// Versioning related information
	IsLatest       bool
	IsDeleteMarker bool
	Version        string
}

// versionMetadataCallback is called when processing the metadata for each blob version.
type versionMetadataCallback func(versionMetadata) error

// IsVersioned returns whether versioning is enabled in the store.
// It returns true even if versioning is enabled but currently suspended for the
// bucket. Notice that when object locking is enabled in a bucket, object
// versioning is enabled and cannot be suspended.
func (s *s3Storage) IsVersioned(ctx context.Context) (bool, error) {
	vi, err := s.cli.GetBucketVersioning(ctx, s.BucketName)
	if err != nil {
		return false, errors.Wrapf(err, "could not get versioning info for %s", s.BucketName)
	}

	return vi.Enabled(), nil
}

// getBlobVersions lists all the versions for the blob with the given ID.
func (s *s3Storage) getBlobVersions(ctx context.Context, prefix blob.ID, callback versionMetadataCallback) error {
	var foundBlobs bool

	if err := s.list(ctx, prefix, true, func(vm versionMetadata) error {
		foundBlobs = true

		return callback(vm)
	}); err != nil {
		return err
	}

	if !foundBlobs {

View on GitHub (pinned to 82495e54b5)