{"record":{"id":"7a40be228878d957","repo":"jaegertracing/jaeger","slug":"failed-to-create-aliases-w","errorCode":null,"errorMessage":"failed to create aliases: %w","messagePattern":"failed to create aliases: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/elasticsearch/esclient/index_client.go","lineNumber":192,"sourceCode":"\t\t\t\treturn responseError.prefixMessage(\"failed to create index: \" + index)\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"failed to create index: %w\", err)\n\t}\n\treturn nil\n}\n\n// CreateAlias an ES specific set of index aliases\nfunc (i *IndicesClient) CreateAlias(ctx context.Context, aliases []Alias) error {\n\terr := i.aliasAction(ctx, \"add\", aliases)\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 aliases: \" + i.aliasesString(aliases))\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"failed to create aliases: %w\", err)\n\t}\n\treturn nil\n}\n\n// DeleteAlias an ES specific set of index aliases\nfunc (i *IndicesClient) DeleteAlias(ctx context.Context, aliases []Alias) error {\n\terr := i.aliasAction(ctx, \"remove\", aliases)\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 delete aliases: \" + i.aliasesString(aliases))\n\t\t\t}\n\t\t}\n\t\treturn fmt.Errorf(\"failed to delete aliases: %w\", err)\n\t}\n\treturn nil\n}","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/elasticsearch/esclient/index_client.go#L174-L210","documentation":"Returned by IndicesClient.CreateAlias when the POST to the _aliases endpoint (add actions) fails with a non-ResponseError cause, i.e. the request never completed as a structured HTTP error. The original error is wrapped with %w. A structured non-200 ES response yields a prefixMessage variant listing the [index, alias] pairs instead.","triggerScenarios":"POST /_aliases with an add-actions body fails at the transport layer: connection refused/reset, timeout, context canceled, or an unparseable error body.","commonSituations":"ES unreachable while Jaeger rolls over indices and re-points write/read aliases; cluster briefly unavailable during maintenance; wrong host config on first boot before indices exist.","solutions":["Verify ES reachability and fix addresses/TLS/credentials in the config","Retry the CreateAlias call — alias add operations are idempotent","Check whether the underlying connection/client (and auth) is configured before the alias step of the rollover flow runs","Unwrap the error to distinguish transport failure from ES-side rejection"],"exampleFix":"// before\nerr := client.CreateAlias(ctx, aliases) // one-shot, aborts rollover\n// after\nif err := client.CreateAlias(ctx, aliases); err != nil {\n    var respErr esclient.ResponseError\n    if !errors.As(err, &respErr) {\n        time.Sleep(time.Second)\n        err = client.CreateAlias(ctx, aliases) // idempotent retry\n    }\n    if err != nil { return err }\n}","handlingStrategy":"retry","validationCode":"// pre-flight: cluster health before alias mutation\nresp, err := http.Get(esURL + \"/_cluster/health\")\nif err != nil || resp.StatusCode != 200 {\n    return fmt.Errorf(\"ES unavailable, skipping CreateAlias\")\n}","typeGuard":"var respErr esclient.ResponseError\nisTransportFailure := !errors.As(err, &respErr)","tryCatchPattern":"if err := client.CreateAlias(ctx, aliases); err != nil {\n    var respErr esclient.ResponseError\n    if errors.As(err, &respErr) {\n        return fmt.Errorf(\"ES rejected aliases (status %d): %w\", respErr.StatusCode, err)\n    }\n    return retryWithBackoff(err) // alias add is idempotent\n}","preventionTips":["Retry alias operations during rollover — they are idempotent","Verify index exists before adding an alias to it (ES rejects aliases on missing indices with a structured error)","Gate rollover/alias flows on cluster health checks"],"tags":["elasticsearch","network","aliases"],"backgroundTag":"elasticsearch-request-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}