{"record":{"id":"412e3c622f2ca077","repo":"grafana/k6","slug":"the-timeunit-must-be-more-than-0-412e3c","errorCode":null,"errorMessage":"the timeUnit must be more than 0","messagePattern":"the timeUnit must be more than 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/executor/ramping_arrival_rate.go","lineNumber":95,"sourceCode":"\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 {\n\t\terrors = append(errors, fmt.Errorf(\"maxVUs can't be less than preAllocatedVUs\"))\n\t}\n\n\treturn errors","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/executor/ramping_arrival_rate.go#L77-L113","documentation":"Raised by RampingArrivalRateConfig.Validate when the scenario's timeUnit option resolves to zero or a negative duration. timeUnit defines the window over which startRate and stage targets are counted, so it must be a positive duration string.","triggerScenarios":"Thrown at lib/executor/ramping_arrival_rate.go:95 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set timeUnit to a positive duration such as \"1s\" or \"1ms\"","Omit timeUnit to use the default of 1s"],"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-14T00:17:10.932Z"}