SigNoz/signoz · error
timeShiftBy param missing in query
Error message
timeShiftBy param missing in query
What it means
Returned when validating a BuildQuery that applies the timeShift function but its Args slice is empty. The validator requires at least one argument so it can verify/normalize the shift amount.
Source
Thrown at pkg/query-service/model/v3/v3.go:1116
for _, selectColumn := range b.SelectColumns {
if err := selectColumn.Validate(); err != nil {
return fmt.Errorf("select column is invalid %w", err)
}
}
if b.Expression == "" {
return fmt.Errorf("expression is required")
}
if len(b.Functions) > 0 {
for _, function := range b.Functions {
if err := function.Name.Validate(); err != nil {
return fmt.Errorf("function name is invalid: %w", err)
}
if function.Name == FunctionNameTimeShift {
if len(function.Args) == 0 {
return fmt.Errorf("timeShiftBy param missing in query")
}
_, ok := function.Args[0].(float64)
if !ok {
// if string, attempt to convert to float
timeShiftBy, err := strconv.ParseFloat(function.Args[0].(string), 64)
if err != nil {
return fmt.Errorf("timeShiftBy param should be a number")
}
function.Args[0] = timeShiftBy
}
} else if function.Name == FunctionNameEWMA3 ||
function.Name == FunctionNameEWMA5 ||
function.Name == FunctionNameEWMA7 {
if len(function.Args) == 0 {
return fmt.Errorf("alpha param missing in query")
}
alpha, ok := function.Args[0].(float64)
if !ok {View on GitHub (pinned to 5069bf80b0)
Solutions
- Add at least one numeric arg representing the shift in seconds, e.g. "args":[3600]
- If args come from a variable, ensure the variable resolves to a non-empty numeric value before sending the query
Example fix
// before
{"name":"timeShift"}
// after
{"name":"timeShift","args":[3600]} Defensive patterns
Strategy: validation
Validate before calling
for _, f := range qb.Functions {
if f.Name == v3.FunctionNameTimeShift && len(f.Args) == 0 {
return errors.New("timeShift requires a shift argument")
}
} Type guard
func hasTimeShiftArg(f v3.Function) bool { return f.Name != v3.FunctionNameTimeShift || len(f.Args) > 0 } Prevention
- Make the timeShift arg required in query-building UI
- Unit-test query payloads before submission
When it happens
Trigger: A query with function Name == FunctionNameTimeShift and len(function.Args) == 0, e.g. JSON with "functions":[{"name":"timeShift"}] and no args array.
Common situations: Frontend bug that drops empty args, manual API calls to /api/v3/query_builder that omit args, or templates that conditionally include args and produce none.
Related errors
- error building clickhouse query: %v
- invalid expression %s: %v
- live tail is only supported for single query
- invalid data type for resource attribute: %s
- unsupported operation, exists and not exists can only be app
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/4e88ef4b58129733.
Report an issue: GitHub.