redis/go-redis · error
FT.AGGREGATE: ASC and DESC are mutually exclusive
Error message
FT.AGGREGATE: ASC and DESC are mutually exclusive
What it means
Error "FT.AGGREGATE: ASC and DESC are mutually exclusive" thrown in redis/go-redis.
Source
Thrown at search_commands.go:766
args = append(args, step.GroupBy.Fields...)
for _, reducer := range step.GroupBy.Reduce {
args = append(args, "REDUCE", reducer.Reducer.String())
if reducer.Args != nil {
args = append(args, len(reducer.Args))
args = append(args, reducer.Args...)
} else {
args = append(args, 0)
}
if reducer.As != "" {
args = append(args, "AS", reducer.As)
}
}
case step.SortBy != nil:
args = append(args, "SORTBY")
sortByOptions := []interface{}{}
for _, sortBy := range step.SortBy.Fields {
if sortBy.Asc && sortBy.Desc {
return args, fmt.Errorf("FT.AGGREGATE: ASC and DESC are mutually exclusive")
}
sortByOptions = append(sortByOptions, sortBy.FieldName)
if sortBy.Asc {
sortByOptions = append(sortByOptions, "ASC")
}
if sortBy.Desc {
sortByOptions = append(sortByOptions, "DESC")
}
}
args = append(args, len(sortByOptions))
args = append(args, sortByOptions...)
if step.SortBy.Max > 0 {
args = append(args, "MAX", step.SortBy.Max)
}
}
return args, nil
}
View on GitHub (pinned to c5cad058c7)
When it happens
Trigger: Thrown at search_commands.go:766 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of redis/go-redis@c5cad058c7 (2026-09-01).
Data as JSON: /api/errors/bd7d240fa01592e7.
Report an issue: GitHub.