{"record":{"id":"6251a883a490bcff","repo":"thanos-io/thanos","slug":"upload-to-backup","errorCode":null,"errorMessage":"upload to backup","messagePattern":"upload to backup","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/verifier/safe_delete.go","lineNumber":142,"sourceCode":"\treturn nil\n}\n\n// backupDownloaded is a helper function that uploads a TSDB block\n// found on disk to the given bucket. An error is returned if any operation\n// fails.\nfunc backupDownloaded(ctx context.Context, logger log.Logger, bdir string, backupBkt objstore.Bucket, id ulid.ULID) error {\n\t// Safety checks.\n\tif _, err := os.Stat(filepath.Join(bdir, \"meta.json\")); err != nil {\n\t\t// If there is any error stat'ing meta.json inside the TSDB block\n\t\t// then declare the existing block as bad and refuse to upload it.\n\t\t// TODO: Make this check more robust.\n\t\treturn errors.Wrap(err, \"existing tsdb block is invalid\")\n\t}\n\n\t// Upload the on disk TSDB block.\n\tlevel.Info(logger).Log(\"msg\", \"Uploading block to backup bucket\", \"id\", id.String())\n\tif err := block.Upload(ctx, logger, backupBkt, bdir, metadata.NoneFunc); err != nil {\n\t\treturn errors.Wrap(err, \"upload to backup\")\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":124,"sourceCodeEnd":147,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/verifier/safe_delete.go#L124-L147","documentation":"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.","triggerScenarios":"BackupAndDelete/BackupAndDeleteDownloaded -> backupDownloaded -> block.Upload(ctx, logger, backupBkt, bdir, metadata.NoneFunc) fails (bucket permissions, size limits, network errors, partial upload).","commonSituations":"Backup bucket credentials missing write permission; object store rejecting large files; network interruption during multipart upload; misconfigured backup bucket name/endpoint.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-check backup bucket write access\nerr := backupBkt.Upload(ctx, \"__perm_test__\", strings.NewReader(\"\"))","typeGuard":null,"tryCatchPattern":"err := backupDownloaded(ctx, logger, bdir, backupBkt, id)\nif err != nil && strings.Contains(err.Error(), \"upload to backup\") {\n\t// retry with backoff; ensure destination dir absent to avoid conflict\n}","preventionTips":["Verify backup bucket credentials/permissions","Check object store size limits and network stability","Confirm backup bucket name/endpoint config"],"tags":["object-storage","upload","backup-bucket"],"backgroundTag":"api-request-failed","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}