grafana/k6 · error
maxVUs can't be less than preAllocatedVUs
Error message
maxVUs can't be less than preAllocatedVUs
What it means
ConstantArrivalRateConfig.Validate found maxVUs smaller than preAllocatedVUs. All pre-allocated VUs count toward maxVUs (the hard ceiling), so preAllocatedVUs > maxVUs is contradictory and rejected before the run starts.
Source
Thrown at lib/executor/constant_arrival_rate.go:121
if !carc.Duration.Valid {
errors = append(errors, fmt.Errorf("the duration is unspecified"))
} else if carc.Duration.TimeDuration() < minDuration {
errors = append(errors, fmt.Errorf(
"the duration must be at least %s, but is %s", minDuration, carc.Duration,
))
}
if !carc.PreAllocatedVUs.Valid {
errors = append(errors, fmt.Errorf("the number of preAllocatedVUs isn't specified"))
} else if carc.PreAllocatedVUs.Int64 < 0 {
errors = append(errors, fmt.Errorf("the number of preAllocatedVUs can't be negative"))
}
if !carc.MaxVUs.Valid {
// TODO: don't change the config while validating
carc.MaxVUs.Int64 = carc.PreAllocatedVUs.Int64
} else if carc.MaxVUs.Int64 < carc.PreAllocatedVUs.Int64 {
errors = append(errors, fmt.Errorf("maxVUs can't be less than preAllocatedVUs"))
}
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 (carc ConstantArrivalRateConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep {
return []lib.ExecutionStep{
{
TimeOffset: 0,
PlannedVUs: uint64(et.ScaleInt64(carc.PreAllocatedVUs.Int64)), //nolint:gosec
MaxUnplannedVUs: uint64(et.ScaleInt64(carc.MaxVUs.Int64) - et.ScaleInt64(carc.PreAllocatedVUs.Int64)), //nolint:gosec
}, {
TimeOffset: carc.Duration.TimeDuration() + carc.GracefulStop.TimeDuration(),View on GitHub (pinned to 01ffac6f24)
Solutions
- Set maxVUs >= preAllocatedVUs, e.g. preAllocatedVUs: 10, maxVUs: 100
- Give headroom in maxVUs if you expect the arrival rate to need more VUs than pre-allocated
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/executor/constant_arrival_rate.go:121 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/f2f9c8217b568c45.
Report an issue: GitHub.