{"record":{"id":"fb4ccfe4f7fadb26","repo":"redis/go-redis","slug":"redis-ts-nrange-ts-nrevrange-requires-exactly-d","errorCode":null,"errorMessage":"redis: TS.NRANGE/TS.NREVRANGE requires exactly %d aggregator spec(s), got %d","messagePattern":"redis: TS\\.NRANGE/TS\\.NREVRANGE requires exactly (.+?) aggregator spec\\(s\\), got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"timeseries_commands.go","lineNumber":1380,"sourceCode":"\t\t\tif cmd.val[i].Values != nil {\n\t\t\t\tval[i].Values = make([]float64, len(cmd.val[i].Values))\n\t\t\t\tcopy(val[i].Values, cmd.val[i].Values)\n\t\t\t}\n\t\t}\n\t}\n\treturn &TSNRangePivotRowSliceCmd{\n\t\tbaseCmd: cmd.cloneBaseCmd(),\n\t\tval:     val,\n\t}\n}\n\n// buildNRangeAggregationArgs validates and returns one aggregator spec string per key for\n// TS.NRANGE / TS.NREVRANGE. The number of specs must equal the number of keys. Each spec\n// lists one or more aggregators for its key and is emitted as a single comma-joined wire\n// token; specs for different keys are separate wire tokens.\nfunc buildNRangeAggregationArgs(keys []string, aggregators [][]Aggregator) ([]string, error) {\n\tif len(aggregators) != len(keys) {\n\t\treturn nil, fmt.Errorf(\"redis: TS.NRANGE/TS.NREVRANGE requires exactly %d aggregator spec(s), got %d\", len(keys), len(aggregators))\n\t}\n\tparts := make([]string, len(aggregators))\n\tfor i, spec := range aggregators {\n\t\tif len(spec) == 0 {\n\t\t\treturn nil, fmt.Errorf(\"redis: empty timeseries aggregator spec at index %d\", i)\n\t\t}\n\t\tnames := make([]string, len(spec))\n\t\tfor j, agg := range spec {\n\t\t\tif agg == Invalid {\n\t\t\t\treturn nil, fmt.Errorf(\"redis: invalid timeseries aggregator at index %d[%d]: Invalid (%d)\", i, j, agg)\n\t\t\t}\n\t\t\ts := agg.String()\n\t\t\tif s == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"redis: invalid timeseries aggregator at index %d[%d]: %d\", i, j, agg)\n\t\t\t}\n\t\t\tnames[j] = s\n\t\t}\n\t\tparts[i] = strings.Join(names, \",\")","sourceCodeStart":1362,"sourceCodeEnd":1398,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/timeseries_commands.go#L1362-L1398","documentation":"Error \"redis: TS.NRANGE/TS.NREVRANGE requires exactly %d aggregator spec(s), got %d\" thrown in redis/go-redis.","triggerScenarios":"Thrown at timeseries_commands.go:1380 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}