thanos-io/thanos · error

initial upload failed

Error message

initial upload failed

What it means

The initial SyncAllTenants upload at receive startup failed after retries within the timeout. Blocks are not yet shipped to object storage; the uploader goroutine will keep retrying but the first failure is returned/logged.

Solutions

  1. Check object storage credentials and connectivity
  2. Verify bucket permissions and existence
  3. Inspect the upload failed warning for the root cause
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at cmd/thanos/receive.go:807 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/3559382bd36a2b8e. Report an issue: GitHub.

Appendix: source

Thrown at cmd/thanos/receive.go:807

	if upload {
		logger := log.With(logger, "component", "uploader")
		upload := func(ctx context.Context) error {
			level.Debug(logger).Log("msg", "upload phase starting")
			start := time.Now()

			uploaded, err := dbs.SyncAllTenants(ctx)
			if err != nil {
				level.Warn(logger).Log("msg", "upload failed", "elapsed", time.Since(start), "err", err)
				return err
			}
			level.Debug(logger).Log("msg", "upload phase done", "uploaded", uploaded, "elapsed", time.Since(start))
			return nil
		}
		{
			level.Info(logger).Log("msg", "upload enabled, starting initial sync")
			if err := upload(context.Background()); err != nil {
				return errors.Wrap(err, "initial upload failed")
			}
			level.Info(logger).Log("msg", "initial sync done")
		}
		{
			ctx, cancel := context.WithCancel(context.Background())
			g.Add(func() error {
				// Ensure we clean up everything properly.
				defer func() {
					runutil.CloseWithLogOnErr(logger, bkt, "bucket client")
				}()

				defer close(uploadDone)

				// Before quitting, ensure all blocks are uploaded.
				defer func() {
					<-uploadC // Closed by storage routine when it's done.
					level.Info(logger).Log("msg", "uploading the final cut block before exiting")
					ctx, cancel := context.WithCancel(context.Background())

View on GitHub (pinned to 35b8b99117)