SigNoz/signoz · error
step param is not in correct format
Error message
step param is not in correct format
What it means
The usage endpoint parses step with strconv.Atoi, so it must be a plain base-10 integer of seconds. Duration strings like 60s, floats like 1.5, or non-numeric values fail parsing.
Source
Thrown at pkg/query-service/app/parser.go:196
}
func parseGetUsageRequest(r *http.Request) (*model.GetUsageParams, error) {
startTime, err := parseTime("start", r)
if err != nil {
return nil, err
}
endTime, err := parseTime("end", r)
if err != nil {
return nil, err
}
stepStr := r.URL.Query().Get("step")
if len(stepStr) == 0 {
return nil, errors.New("step param missing in query")
}
stepInt, err := strconv.Atoi(stepStr)
if err != nil {
return nil, errors.New("step param is not in correct format")
}
serviceName := r.URL.Query().Get("service")
stepHour := stepInt / 3600
getUsageParams := model.GetUsageParams{
StartTime: startTime.Format(time.RFC3339Nano),
EndTime: endTime.Format(time.RFC3339Nano),
Start: startTime,
End: endTime,
ServiceName: serviceName,
Period: fmt.Sprintf("PT%dH", stepHour),
StepHour: stepHour,
}
return &getUsageParams, nil
}View on GitHub (pinned to 5069bf80b0)
Solutions
- Send step as an integer number of seconds: 60 not 60s, 3600 not 1h
- Convert durations client-side before building the URL: seconds = duration.Seconds() as int
- Verify no whitespace or units sneak into the value
Example fix
// before
params.Set("step", "1h")
// after
params.Set("step", "3600") Defensive patterns
Strategy: validation
Validate before calling
stepStr := strconv.Itoa(int(d.Seconds())) // not d.String()
q.Set("step", stepStr)
if _, err := strconv.Atoi(stepStr); err != nil {
return errors.New("step must be integer seconds")
} Prevention
- Never pass duration strings (1h, 15s) to this endpoint
- Centralize param serialization in one helper
- Fuzz/property-test param building with random durations
When it happens
Trigger: GET /api/v1/usage?step=60s, ?step=1h, ?step=1.5, or ?step=five — anything not parseable by Go's Atoi.
Common situations: Reusing Prometheus-style duration strings (15s, 1h) on the usage endpoint; passing milliseconds (3600000) thinking it's a duration format; locale-formatted numbers.
Related errors
- zero or negative query resolution step widths are not accept
- step param missing in query
- CodeLicenseUnavailable
- CodeLicenseUnavailable
- CodeInvalidInput
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/d85a2a3aa73efa74.
Report an issue: GitHub.