thanos-io/thanos · error
upload to backup
Error message
upload to backup
What it means
backupDownloaded uploads the on-disk TSDB block to the backup bucket with block.Upload; any failure is wrapped as "upload to backup". This means the local block was considered valid but the multi-file upload to the backup bucket failed partway.
Solutions
- Verify backup bucket credentials and write permissions
- Check object store limits (max object size, multipart config) and network connectivity
- Retry the repair; re-upload is safe when the destination is absent
- Inspect the wrapped block.Upload error for the specific object and cause
Defensive patterns
Strategy: retry
Validate before calling
// pre-check backup bucket write access
err := backupBkt.Upload(ctx, "__perm_test__", strings.NewReader("")) Try / catch
err := backupDownloaded(ctx, logger, bdir, backupBkt, id)
if err != nil && strings.Contains(err.Error(), "upload to backup") {
// retry with backoff; ensure destination dir absent to avoid conflict
} Prevention
- Verify backup bucket credentials/permissions
- Check object store size limits and network stability
- Confirm backup bucket name/endpoint config
When it happens
Trigger: BackupAndDelete/BackupAndDeleteDownloaded -> backupDownloaded -> block.Upload(ctx, logger, backupBkt, bdir, metadata.NoneFunc) fails (bucket permissions, size limits, network errors, partial upload).
Common situations: Backup bucket credentials missing write permission; object store rejecting large files; network interruption during multipart upload; misconfigured backup bucket name/endpoint.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/6251a883a490bcff.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/verifier/safe_delete.go:142
return nil
}
// backupDownloaded is a helper function that uploads a TSDB block
// found on disk to the given bucket. An error is returned if any operation
// fails.
func backupDownloaded(ctx context.Context, logger log.Logger, bdir string, backupBkt objstore.Bucket, id ulid.ULID) error {
// Safety checks.
if _, err := os.Stat(filepath.Join(bdir, "meta.json")); err != nil {
// If there is any error stat'ing meta.json inside the TSDB block
// then declare the existing block as bad and refuse to upload it.
// TODO: Make this check more robust.
return errors.Wrap(err, "existing tsdb block is invalid")
}
// Upload the on disk TSDB block.
level.Info(logger).Log("msg", "Uploading block to backup bucket", "id", id.String())
if err := block.Upload(ctx, logger, backupBkt, bdir, metadata.NoneFunc); err != nil {
return errors.Wrap(err, "upload to backup")
}
return nil
}
View on GitHub (pinned to 35b8b99117)