jaegertracing/jaeger · error
failed to create aliases: %w
Error message
failed to create aliases: %w
What it means
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.
Source
Thrown at internal/storage/elasticsearch/esclient/index_client.go:192
return responseError.prefixMessage("failed to create index: " + index)
}
}
return fmt.Errorf("failed to create index: %w", err)
}
return nil
}
// CreateAlias an ES specific set of index aliases
func (i *IndicesClient) CreateAlias(ctx context.Context, aliases []Alias) error {
err := i.aliasAction(ctx, "add", aliases)
if err != nil {
var responseError ResponseError
if errors.As(err, &responseError) {
if responseError.StatusCode != http.StatusOK {
return responseError.prefixMessage("failed to create aliases: " + i.aliasesString(aliases))
}
}
return fmt.Errorf("failed to create aliases: %w", err)
}
return nil
}
// DeleteAlias an ES specific set of index aliases
func (i *IndicesClient) DeleteAlias(ctx context.Context, aliases []Alias) error {
err := i.aliasAction(ctx, "remove", aliases)
if err != nil {
var responseError ResponseError
if errors.As(err, &responseError) {
if responseError.StatusCode != http.StatusOK {
return responseError.prefixMessage("failed to delete aliases: " + i.aliasesString(aliases))
}
}
return fmt.Errorf("failed to delete aliases: %w", err)
}
return nil
}View on GitHub (pinned to 806f444784)
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
Example fix
// before
err := client.CreateAlias(ctx, aliases) // one-shot, aborts rollover
// after
if err := client.CreateAlias(ctx, aliases); err != nil {
var respErr esclient.ResponseError
if !errors.As(err, &respErr) {
time.Sleep(time.Second)
err = client.CreateAlias(ctx, aliases) // idempotent retry
}
if err != nil { return err }
} Defensive patterns
Strategy: retry
Validate before calling
// pre-flight: cluster health before alias mutation
resp, err := http.Get(esURL + "/_cluster/health")
if err != nil || resp.StatusCode != 200 {
return fmt.Errorf("ES unavailable, skipping CreateAlias")
} Type guard
var respErr esclient.ResponseError isTransportFailure := !errors.As(err, &respErr)
Try / catch
if err := client.CreateAlias(ctx, aliases); err != nil {
var respErr esclient.ResponseError
if errors.As(err, &respErr) {
return fmt.Errorf("ES rejected aliases (status %d): %w", respErr.StatusCode, err)
}
return retryWithBackoff(err) // alias add is idempotent
} Prevention
- 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
When it happens
Trigger: POST /_aliases with an add-actions body fails at the transport layer: connection refused/reset, timeout, context canceled, or an unparseable error body.
Common situations: 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.
Related errors
- failed to delete aliases: %w
- failed to resolve backend version: %w
- failed to delete indices: %w
- failed to create index: %w
- failed to check if alias exists: %w
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/7a40be228878d957.
Report an issue: GitHub.