{"record":{"id":"676cb6f6e279e8b5","repo":"grafana/k6","slug":"the-startrate-value-can-t-be-negative","errorCode":null,"errorMessage":"the startRate value can't be negative","messagePattern":"the startRate value can't be negative","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/executor/ramping_arrival_rate.go","lineNumber":91,"sourceCode":"\tif varc.MaxVUs.Int64 > varc.PreAllocatedVUs.Int64 {\n\t\tmaxVUsRange += fmt.Sprintf(\"-%d\", et.ScaleInt64(varc.MaxVUs.Int64))\n\t}\n\tmaxUnscaledRate := getStagesUnscaledMaxTarget(varc.StartRate.Int64, varc.Stages)\n\tmaxArrRatePerSec, _ := getArrivalRatePerSec(\n\t\tgetScaledArrivalRate(et.Segment, maxUnscaledRate, varc.TimeUnit.TimeDuration()),\n\t).Float64()\n\n\treturn fmt.Sprintf(\"Up to %.2f iterations/s for %s over %d stages%s\",\n\t\tmaxArrRatePerSec, sumStagesDuration(varc.Stages),\n\t\tlen(varc.Stages), varc.getBaseInfo(maxVUsRange))\n}\n\n// Validate makes sure all options are configured and valid\nfunc (varc *RampingArrivalRateConfig) Validate() []error {\n\terrors := varc.BaseConfig.Validate()\n\n\tif varc.StartRate.Int64 < 0 {\n\t\terrors = append(errors, fmt.Errorf(\"the startRate value can't be negative\"))\n\t}\n\n\tif varc.TimeUnit.TimeDuration() <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"the timeUnit must be more than 0\"))\n\t}\n\n\terrors = append(errors, validateStages(varc.Stages)...)\n\n\tif !varc.PreAllocatedVUs.Valid {\n\t\terrors = append(errors, fmt.Errorf(\"the number of preAllocatedVUs isn't specified\"))\n\t} else if varc.PreAllocatedVUs.Int64 < 0 {\n\t\terrors = append(errors, fmt.Errorf(\"the number of preAllocatedVUs can't be negative\"))\n\t}\n\n\tif !varc.MaxVUs.Valid {\n\t\t// TODO: don't change the config while validating\n\t\tvarc.MaxVUs.Int64 = varc.PreAllocatedVUs.Int64\n\t} else if varc.MaxVUs.Int64 < varc.PreAllocatedVUs.Int64 {","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/executor/ramping_arrival_rate.go#L73-L109","documentation":"Raised by RampingArrivalRateConfig.Validate when the scenario's startRate option is a negative number. The arrival-rate ramping executor treats startRate as the baseline iterations-per-timeUnit, which cannot be negative.","triggerScenarios":"Thrown at lib/executor/ramping_arrival_rate.go:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set startRate to 0 or a positive number in the ramping-arrival-rate scenario options","Start at 0 and let the first stage's target define the initial load"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}