{"record":{"id":"a207b206dcdd5dc5","repo":"jaegertracing/jaeger","slug":"failed-to-create-rollover-w","errorCode":null,"errorMessage":"failed to create rollover: %w","messagePattern":"failed to create rollover: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/elasticsearch/esclient/index_client.go","lineNumber":340,"sourceCode":"\tif len(conditions) > 0 {\n\t\tbody := map[string]any{\n\t\t\t\"conditions\": conditions,\n\t\t}\n\t\tbodyBytes, err := json.Marshal(body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tesReq.body = bodyBytes\n\t}\n\t_, err := i.request(ctx, esReq)\n\tif err != nil {\n\t\tvar responseError ResponseError\n\t\tif errors.As(err, &responseError) {\n\t\t\tif responseError.StatusCode != http.StatusOK {\n\t\t\t\treturn responseError.prefixMessage(\"failed to create rollover target: \" + rolloverTarget)\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"failed to create rollover: %w\", err)\n\t}\n\treturn nil\n}\n\n// templateEndpoint returns the index-template API path for name: the composable\n// (_index_template) endpoint on backends that use the v8 API, the legacy\n// (_template) endpoint otherwise. CreateTemplate and the TestsOnly template\n// helpers all route through here so the endpoint choice lives in one place.\nfunc (i IndicesClient) templateEndpoint(name string) string {\n\tif i.version.UsesV8API() {\n\t\treturn \"_index_template/\" + name\n\t}\n\treturn \"_template/\" + name\n}\n\n// TestsOnlyTemplateExists reports whether the index template for name exists,\n// using the same endpoint CreateTemplate installs it under. Integration-test-only\n// — production never checks a template's existence.","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/elasticsearch/esclient/index_client.go#L322-L358","documentation":"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.","triggerScenarios":"POST <alias>/_rollover/ (optionally with conditions body) fails at the transport layer: connection failure, timeout, context cancellation, or malformed response.","commonSituations":"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.","solutions":["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)","Increase request timeout if rollovers are slow due to large indices","Check whether an ILM/ISM policy is also managing the target, causing conflicts","Unwrap the %w chain for the transport cause (timeout vs connection reset)"],"exampleFix":"// before\nif err := client.Rollover(ctx, \"jaeger-span-write\", conditions); err != nil {\n    return err\n}\n// after\nif err := client.Rollover(ctx, \"jaeger-span-write\", conditions); err != nil {\n    var respErr esclient.ResponseError\n    if !errors.As(err, &respErr) {\n        return retryable(err) // transport failure: rollover is idempotent\n    }\n    return err\n}","handlingStrategy":"retry","validationCode":"// pre-flight: target alias/index exists\nok, err := client.IndexExists(ctx, rolloverTarget)\nif err != nil || !ok {\n    return fmt.Errorf(\"rollover target missing\")\n}","typeGuard":"var respErr esclient.ResponseError\nisTransportFailure := !errors.As(err, &respErr)","tryCatchPattern":"if err := client.Rollover(ctx, target, conditions); err != nil {\n    var respErr esclient.ResponseError\n    if errors.As(err, &respErr) {\n        return fmt.Errorf(\"ES rejected rollover (status %d): %w\", respErr.StatusCode, err)\n    }\n    return retryWithBackoff(err) // rollover re-issue is safe\n}","preventionTips":["Schedule rollovers with retries and jitter; avoid firing during ES maintenance windows","Set conditions so repeated calls don't roll over repeatedly","Monitor cluster GC/heap pressure around scheduled rollover times"],"tags":["elasticsearch","rollover","network"],"backgroundTag":"elasticsearch-request-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}