grafana/k6 · error

the number of start VUs can't be negative

Error message

the number of start VUs can't be negative

What it means

Raised by RampingVUsConfig.Validate when the ramping-vus scenario's startVUs option is negative. startVUs is the initial VU count at test start and cannot be below zero.

Source

Thrown at lib/executor/ramping_vus.go:88

// GetGracefulRampDown is just a helper method that returns the graceful
// ramp-down period as a standard Go time.Duration value...
func (vlvc RampingVUsConfig) GetGracefulRampDown() time.Duration {
	return vlvc.GracefulRampDown.TimeDuration()
}

// GetDescription returns a human-readable description of the executor options
func (vlvc RampingVUsConfig) GetDescription(et *lib.ExecutionTuple) string {
	maxVUs := et.ScaleInt64(getStagesUnscaledMaxTarget(vlvc.StartVUs.Int64, vlvc.Stages))
	return fmt.Sprintf("Up to %d looping VUs for %s over %d stages%s",
		maxVUs, sumStagesDuration(vlvc.Stages), len(vlvc.Stages),
		vlvc.getBaseInfo(fmt.Sprintf("gracefulRampDown: %s", vlvc.GetGracefulRampDown())))
}

// Validate makes sure all options are configured and valid
func (vlvc RampingVUsConfig) Validate() []error {
	errors := vlvc.BaseConfig.Validate()
	if vlvc.StartVUs.Int64 < 0 {
		errors = append(errors, fmt.Errorf("the number of start VUs can't be negative"))
	}

	if getStagesUnscaledMaxTarget(vlvc.StartVUs.Int64, vlvc.Stages) <= 0 {
		errors = append(errors, fmt.Errorf("either startVUs or one of the stages' target values must be greater than 0"))
	}

	errors = append(errors, validateStages(vlvc.Stages)...)
	errors = append(errors, validateTargetShifts(vlvc.StartVUs.Int64, vlvc.Stages)...)

	return errors
}

// getRawExecutionSteps calculates and returns as execution steps the number of
// actively running VUs the executor should have at every moment.
//
// It doesn't take into account graceful ramp-downs. It also doesn't deal with
// the end-of-executor drop to 0 VUs, whether graceful or not. These are
// handled by GetExecutionRequirements(), which internally uses this method and

View on GitHub (pinned to 01ffac6f24)

Solutions

  1. Set startVUs to 0 or a positive number
  2. Start at 0 VUs and ramp up via the first stage's target
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/executor/ramping_vus.go:88 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/db3c34e42207778f. Report an issue: GitHub.