thanos-io/thanos · error

unsupported remote_write version

Error message

unsupported remote_write version

What it means

The rwVersion switch in the remote-write HTTP handler hit its default case: determineRWVersion returned an unrecognized version, so the request cannot be dispatched to v1 or v2 handling and is answered 400.

Solutions

  1. Send a supported remote-write protocol version (1 or 2).
  2. Update the client SDK; check X-Prometheus-Remote-Write-Version and Content-Type consistency.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/receive/handler.go:864 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/6515912603ab9d1d. Report an issue: GitHub.

Appendix: source

Thrown at pkg/receive/handler.go:864

		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}

	switch rwVersion {
	case 1:
		// NOTE: Due to zero copy ZLabels, Labels used from WriteRequests keeps memory
		// from the whole request. Ensure that we always copy those when we want to
		// store them for longer time.
		var wreq prompb.WriteRequest
		if err := proto.Unmarshal(reqBuf, &wreq); err != nil {
			http.Error(w, err.Error(), http.StatusBadRequest)
			return
		}
		_ = h.handleV1HTTP(ctx, w, r, &wreq, tLogger, tenantHTTP, requestLimiter)
	case 2:
		h.handleV2HTTP(ctx, w, r, reqBuf, tLogger, tenantHTTP, requestLimiter)
	default:
		panic("unsupported remote_write version")
	}
}

type requestStats struct {
	timeseries   int
	totalSamples int
}

type tenantRequestStats map[string]requestStats

func (h *Handler) handleRequest(ctx context.Context, rep uint64, data []wreqTenantTuple) (tenantRequestStats, error) {
	tLogger := h.logger

	// This replica value is used to detect cycles in cyclic topologies.
	// A non-zero value indicates that the request has already been replicated by a previous receive instance.
	// For almost all users, this is only used in fully connected topologies of IngestorRouter instances.
	// For acyclic topologies that use RouterOnly and IngestorOnly instances, this causes issues when replicating data.
	// See discussion in: https://github.com/thanos-io/thanos/issues/4359.

View on GitHub (pinned to 35b8b99117)