jaegertracing/jaeger · error

failed to create rollover: %w

Error message

failed to create rollover: %w

What it means

Returned by IndicesClient.Rollover when the POST to <target>/_rollover/ fails with a non-ResponseError cause (transport-level failure or an unparseable error body). A structured non-200 ES response is returned instead as a prefixMessage variant naming the rollover target. The error means the rollover request did not complete as a recognized ES rejection.

Source

Thrown at internal/storage/elasticsearch/esclient/index_client.go:340

	if len(conditions) > 0 {
		body := map[string]any{
			"conditions": conditions,
		}
		bodyBytes, err := json.Marshal(body)
		if err != nil {
			return err
		}
		esReq.body = bodyBytes
	}
	_, err := i.request(ctx, esReq)
	if err != nil {
		var responseError ResponseError
		if errors.As(err, &responseError) {
			if responseError.StatusCode != http.StatusOK {
				return responseError.prefixMessage("failed to create rollover target: " + rolloverTarget)
			}
		}
		return fmt.Errorf("failed to create rollover: %w", err)
	}
	return nil
}

// templateEndpoint returns the index-template API path for name: the composable
// (_index_template) endpoint on backends that use the v8 API, the legacy
// (_template) endpoint otherwise. CreateTemplate and the TestsOnly template
// helpers all route through here so the endpoint choice lives in one place.
func (i IndicesClient) templateEndpoint(name string) string {
	if i.version.UsesV8API() {
		return "_index_template/" + name
	}
	return "_template/" + name
}

// TestsOnlyTemplateExists reports whether the index template for name exists,
// using the same endpoint CreateTemplate installs it under. Integration-test-only
// — production never checks a template's existence.

View on GitHub (pinned to 806f444784)

Solutions

  1. Verify ES cluster health and retry — the rollover API is safe to re-issue (it only rolls over when conditions are met or once per target state)
  2. Increase request timeout if rollovers are slow due to large indices
  3. Check whether an ILM/ISM policy is also managing the target, causing conflicts
  4. Unwrap the %w chain for the transport cause (timeout vs connection reset)

Example fix

// before
if err := client.Rollover(ctx, "jaeger-span-write", conditions); err != nil {
    return err
}
// after
if err := client.Rollover(ctx, "jaeger-span-write", conditions); err != nil {
    var respErr esclient.ResponseError
    if !errors.As(err, &respErr) {
        return retryable(err) // transport failure: rollover is idempotent
    }
    return err
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight: target alias/index exists
ok, err := client.IndexExists(ctx, rolloverTarget)
if err != nil || !ok {
    return fmt.Errorf("rollover target missing")
}

Type guard

var respErr esclient.ResponseError
isTransportFailure := !errors.As(err, &respErr)

Try / catch

if err := client.Rollover(ctx, target, conditions); err != nil {
    var respErr esclient.ResponseError
    if errors.As(err, &respErr) {
        return fmt.Errorf("ES rejected rollover (status %d): %w", respErr.StatusCode, err)
    }
    return retryWithBackoff(err) // rollover re-issue is safe
}

Prevention

When it happens

Trigger: POST <alias>/_rollover/ (optionally with conditions body) fails at the transport layer: connection failure, timeout, context cancellation, or malformed response.

Common situations: Nightly rollover job hitting an ES node that is under GC pressure or restarting; network flaps between Jaeger and ES; ilm/ism policy conflicts causing long-running requests that hit the client timeout.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/a207b206dcdd5dc5. Report an issue: GitHub.