{"record":{"id":"f4f5672b936ecc9e","repo":"grafana/k6","slug":"the-maxduration-must-be-at-least-s-but-is-s","errorCode":null,"errorMessage":"the maxDuration must be at least %s, but is %s","messagePattern":"the maxDuration must be at least (.+?), but is (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/executor/per_vu_iterations.go","lineNumber":82,"sourceCode":"func (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{\n\t\t{\n\t\t\tTimeOffset: 0,\n\t\t\tPlannedVUs: uint64(pvic.GetVUs(et)), //nolint:gosec\n\t\t},","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/lib/executor/per_vu_iterations.go#L64-L100","documentation":"Raised by PerVUIterationsConfig.Validate when the scenario's maxDuration option is shorter than the executor's minimum allowed duration (minDuration). The check compares the configured maxDuration against the internal floor, so any explicitly tiny or defaulted-to-zero duration triggers it.","triggerScenarios":"Thrown at lib/executor/per_vu_iterations.go:82 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set maxDuration to at least the minimum required duration in the scenario options","Remove a custom maxDuration so the default applies","Use a different executor (e.g. per-vu-iterations without the shared duration constraint) if a shorter run is needed"],"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"}