grafana/k6 · error

the number of iterations (%d) can't be less than the number

Error message

the number of iterations (%d) can't be less than the number of VUs (%d)

What it means

Raised by SharedIterationsConfig.Validate when the shared-iterations scenario declares fewer total iterations than VUs. k6 requires at least one iteration per VU because every VU must be able to run at least once.

Source

Thrown at lib/executor/shared_iterations.go:83

	return newTuple.ScaleInt64(sic.Iterations.Int64)
}

// GetDescription returns a human-readable description of the executor options
func (sic SharedIterationsConfig) GetDescription(et *lib.ExecutionTuple) string {
	return fmt.Sprintf("%d iterations shared among %d VUs%s",
		sic.GetIterations(et), sic.GetVUs(et),
		sic.getBaseInfo(fmt.Sprintf("maxDuration: %s", sic.MaxDuration.Duration)))
}

// Validate makes sure all options are configured and valid
func (sic SharedIterationsConfig) Validate() []error {
	errors := sic.BaseConfig.Validate()
	if sic.VUs.Int64 <= 0 {
		errors = append(errors, fmt.Errorf("the number of VUs must be more than 0"))
	}

	if sic.Iterations.Int64 < sic.VUs.Int64 {
		errors = append(errors, fmt.Errorf(
			"the number of iterations (%d) can't be less than the number of VUs (%d)",
			sic.Iterations.Int64, sic.VUs.Int64,
		))
	}

	if sic.MaxDuration.TimeDuration() < minDuration {
		errors = append(errors, fmt.Errorf(
			"the maxDuration must be at least %s, but is %s", minDuration, sic.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

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Increase iterations so it is greater than or equal to vus
  2. Reduce vus so each VU gets at least one iteration
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/executor/shared_iterations.go:83 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/9ac31ac6a509d421. Report an issue: GitHub.