grafana/k6 · error
the number of iterations must be more than 0
Error message
the number of iterations must be more than 0
What it means
PerVUIterationsConfig.Validate rejected an iterations value <= 0. Each VU must run at least one iteration; iterations is not segment-scaled (only vus is), so the value itself must be positive in the scenario options.
Source
Thrown at lib/executor/per_vu_iterations.go:78
return pvic.Iterations.Int64
}
// GetDescription returns a human-readable description of the executor options
func (pvic PerVUIterationsConfig) GetDescription(et *lib.ExecutionTuple) string {
return fmt.Sprintf("%d iterations for each of %d VUs%s",
pvic.GetIterations(), pvic.GetVUs(et),
pvic.getBaseInfo(fmt.Sprintf("maxDuration: %s", pvic.MaxDuration.Duration)))
}
// Validate makes sure all options are configured and valid
func (pvic PerVUIterationsConfig) Validate() []error {
errors := pvic.BaseConfig.Validate()
if pvic.VUs.Int64 <= 0 {
errors = append(errors, fmt.Errorf("the number of VUs must be more than 0"))
}
if pvic.Iterations.Int64 <= 0 {
errors = append(errors, fmt.Errorf("the number of iterations must be more than 0"))
}
if pvic.MaxDuration.TimeDuration() < minDuration {
errors = append(errors, fmt.Errorf(
"the maxDuration must be at least %s, but is %s", minDuration, pvic.MaxDuration,
))
}
return errors
}
// GetExecutionRequirements returns the number of required VUs to run the
// executor for its whole duration (disregarding any startTime), including the
// maximum waiting time for any iterations to gracefully stop. This is used by
// the execution scheduler in its VU reservation calculations, so it knows how
// many VUs to pre-initialize.
func (pvic PerVUIterationsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep {
return []lib.ExecutionStep{View on GitHub (pinned to 01ffac6f24)
Solutions
- Set iterations to a positive integer, e.g. iterations: 5
- Adjust vus rather than iterations when distributing load across segments
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/executor/per_vu_iterations.go:78 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/078ed31840cfba5d.
Report an issue: GitHub.