grafana/k6 · error
the maxDuration must be at least %s, but is %s
Error message
the maxDuration must be at least %s, but is %s
What it means
Raised by PerVUIterationsConfig.Validate when the scenario's maxDuration option is shorter than the executor's minimum allowed duration (minDuration). The check compares the configured maxDuration against the internal floor, so any explicitly tiny or defaulted-to-zero duration triggers it.
Source
Thrown at lib/executor/per_vu_iterations.go:82
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{
{
TimeOffset: 0,
PlannedVUs: uint64(pvic.GetVUs(et)), //nolint:gosec
},View on GitHub (pinned to 01ffac6f24)
Solutions
- Set maxDuration to at least the minimum required duration in the scenario options
- Remove a custom maxDuration so the default applies
- Use a different executor (e.g. per-vu-iterations without the shared duration constraint) if a shorter run is needed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/executor/per_vu_iterations.go:82 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/f4f5672b936ecc9e.
Report an issue: GitHub.