{"record":{"id":"0483fc08a71737ca","repo":"jaegertracing/jaeger","slug":"failed-to-delete-aliases-w","errorCode":null,"errorMessage":"failed to delete aliases: %w","messagePattern":"failed to delete aliases: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/elasticsearch/esclient/index_client.go","lineNumber":207,"sourceCode":"\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}\n\n// AliasExists check whether an alias exists or not\nfunc (i *IndicesClient) AliasExists(ctx context.Context, alias string) (bool, error) {\n\t_, err := i.request(ctx, elasticRequest{\n\t\tendpoint: \"_alias/\" + alias,\n\t\tmethod:   http.MethodHead,\n\t})\n\tif err != nil {\n\t\tvar responseError ResponseError\n\t\tif errors.As(err, &responseError) {\n\t\t\tif responseError.StatusCode == http.StatusNotFound {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t}\n\t\treturn false, fmt.Errorf(\"failed to check if alias exists: %w\", err)","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/elasticsearch/esclient/index_client.go#L189-L225","documentation":"Returned by IndicesClient.DeleteAlias when the POST to the _aliases endpoint with remove actions fails with a non-ResponseError cause (transport-level failure or unparseable error). The cause is wrapped with %w. Structured ES rejections are returned as a prefixMessage variant naming the aliases.","triggerScenarios":"POST /_aliases with remove actions fails before a structured HTTP error is returned: connection failure, timeout, canceled context, or malformed response body.","commonSituations":"Removing stale aliases during rollover while ES is being restarted; network partition between Jaeger and ES; security layer (SearchGuard/X-Pack) dropping the request without a JSON error.","solutions":["Confirm ES is up and the configured addresses are correct","Retry DeleteAlias — removing an alias is idempotent","Check proxy/security middleware that might terminate requests without a JSON error body","Unwrap with errors.Is/As to reach the transport-level cause"],"exampleFix":"// before\nif err := client.DeleteAlias(ctx, oldAliases); err != nil { return err }\n// after\nif err := client.DeleteAlias(ctx, oldAliases); err != nil {\n    var respErr esclient.ResponseError\n    if !errors.As(err, &respErr) {\n        return retryLater(err) // transport failure: safe to retry\n    }\n    return err\n}","handlingStrategy":"retry","validationCode":"// confirm alias currently exists before attempting removal\nexists, err := client.AliasExists(ctx, alias.Name)\nif err != nil || !exists {\n    return nil // nothing to delete\n}","typeGuard":"var respErr esclient.ResponseError\nisTransportFailure := !errors.As(err, &respErr)","tryCatchPattern":"if err := client.DeleteAlias(ctx, aliases); err != nil {\n    var respErr esclient.ResponseError\n    if errors.As(err, &respErr) {\n        return fmt.Errorf(\"ES rejected alias removal (status %d): %w\", respErr.StatusCode, err)\n    }\n    return retryWithBackoff(err) // idempotent\n}","preventionTips":["Check AliasExists before DeleteAlias to skip no-op work","Retry transport failures; alias removal is safe to repeat","Watch for security plugins intercepting requests without JSON error bodies"],"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"}