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

  1. Send step as an integer number of seconds: 60 not 60s, 3600 not 1h
  2. Convert durations client-side before building the URL: seconds = duration.Seconds() as int
  3. 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

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


AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28). Data as JSON: /api/errors/d85a2a3aa73efa74. Report an issue: GitHub.