grafana/k6 · error
the duration is unspecified
Error message
the duration is unspecified
What it means
ConstantVUsConfig.Validate found 'duration' unset. The constant-VUs executor has no natural end condition — VUs loop until the fixed duration elapses — so the option is required, unlike executors with iteration counts.
Source
Thrown at lib/executor/constant_vus.go:72
func (clvc ConstantVUsConfig) GetVUs(et *lib.ExecutionTuple) int64 {
return et.ScaleInt64(clvc.VUs.Int64)
}
// GetDescription returns a human-readable description of the executor options
func (clvc ConstantVUsConfig) GetDescription(et *lib.ExecutionTuple) string {
return fmt.Sprintf("%d looping VUs for %s%s",
clvc.GetVUs(et), clvc.Duration.Duration, clvc.getBaseInfo())
}
// Validate makes sure all options are configured and valid
func (clvc ConstantVUsConfig) Validate() []error {
errors := clvc.BaseConfig.Validate()
if clvc.VUs.Int64 <= 0 {
errors = append(errors, fmt.Errorf("the number of VUs must be more than 0"))
}
if !clvc.Duration.Valid {
errors = append(errors, fmt.Errorf("the duration is unspecified"))
} else if clvc.Duration.TimeDuration() < minDuration {
errors = append(errors, fmt.Errorf(
"the duration must be at least %s, but is %s", minDuration, clvc.Duration,
))
}
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 (clvc ConstantVUsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep {
return []lib.ExecutionStep{
{
TimeOffset: 0,View on GitHub (pinned to 01ffac6f24)
Solutions
- Add duration to the scenario, e.g. duration: '10m'
- For a fixed number of iterations use per-vu-iterations or shared-iterations instead
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/executor/constant_vus.go:72 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/70d14ce92ec5ce8e.
Report an issue: GitHub.