{"record":{"id":"078ed31840cfba5d","repo":"grafana/k6","slug":"the-number-of-iterations-must-be-more-than-0","errorCode":null,"errorMessage":"the number of iterations must be more than 0","messagePattern":"the number of iterations must be more than 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/executor/per_vu_iterations.go","lineNumber":78,"sourceCode":"\treturn pvic.Iterations.Int64\n}\n\n// GetDescription returns a human-readable description of the executor options\nfunc (pvic PerVUIterationsConfig) GetDescription(et *lib.ExecutionTuple) string {\n\treturn fmt.Sprintf(\"%d iterations for each of %d VUs%s\",\n\t\tpvic.GetIterations(), pvic.GetVUs(et),\n\t\tpvic.getBaseInfo(fmt.Sprintf(\"maxDuration: %s\", pvic.MaxDuration.Duration)))\n}\n\n// Validate makes sure all options are configured and valid\nfunc (pvic PerVUIterationsConfig) Validate() []error {\n\terrors := pvic.BaseConfig.Validate()\n\tif pvic.VUs.Int64 <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"the number of VUs must be more than 0\"))\n\t}\n\n\tif pvic.Iterations.Int64 <= 0 {\n\t\terrors = append(errors, fmt.Errorf(\"the number of iterations must be more than 0\"))\n\t}\n\n\tif pvic.MaxDuration.TimeDuration() < minDuration {\n\t\terrors = append(errors, fmt.Errorf(\n\t\t\t\"the maxDuration must be at least %s, but is %s\", minDuration, pvic.MaxDuration,\n\t\t))\n\t}\n\n\treturn errors\n}\n\n// GetExecutionRequirements returns the number of required VUs to run the\n// executor for its whole duration (disregarding any startTime), including the\n// maximum waiting time for any iterations to gracefully stop. This is used by\n// the execution scheduler in its VU reservation calculations, so it knows how\n// many VUs to pre-initialize.\nfunc (pvic PerVUIterationsConfig) GetExecutionRequirements(et *lib.ExecutionTuple) []lib.ExecutionStep {\n\treturn []lib.ExecutionStep{","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/executor/per_vu_iterations.go#L60-L96","documentation":"PerVUIterationsConfig.Validate rejected an iterations value <= 0. Each VU must run at least one iteration; iterations is not segment-scaled (only vus is), so the value itself must be positive in the scenario options.","triggerScenarios":"Thrown at lib/executor/per_vu_iterations.go:78 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set iterations to a positive integer, e.g. iterations: 5","Adjust vus rather than iterations when distributing load across segments"],"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"}