{"record":{"id":"0724544c67f3a748","repo":"grafana/k6","slug":"setuptimeout-must-be-positive","errorCode":null,"errorMessage":"setupTimeout must be positive","messagePattern":"setupTimeout must be positive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/options.go","lineNumber":557,"sourceCode":"\t// TODO: validate all of the other options... that we should have already been validating...\n\t// TODO: maybe integrate an external validation lib: https://github.com/avelino/awesome-go#validation\n\tvar validationErrors []error\n\tif o.ExecutionSegmentSequence != nil {\n\t\tvar segmentFound bool\n\t\tif slices.ContainsFunc(*o.ExecutionSegmentSequence, o.ExecutionSegment.Equal) {\n\t\t\tsegmentFound = true\n\t\t}\n\t\tif !segmentFound {\n\t\t\tvalidationErrors = append(validationErrors,\n\t\t\t\tfmt.Errorf(\"provided segment %s can't be found in sequence %s\",\n\t\t\t\t\to.ExecutionSegment, o.ExecutionSegmentSequence))\n\t\t}\n\t}\n\tvalidationErrors = append(validationErrors, o.Scenarios.Validate()...)\n\n\t// Duration\n\tif o.SetupTimeout.Valid && o.SetupTimeout.Duration <= 0 {\n\t\tvalidationErrors = append(validationErrors, errors.New(\"setupTimeout must be positive\"))\n\t}\n\treturn validationErrors\n}\n\n// ForEachSpecified enumerates all struct fields and calls the supplied function with each\n// element that is valid. It panics for any unfamiliar or unexpected fields, so make sure\n// new fields in Options are accounted for.\nfunc (o Options) ForEachSpecified(structTag string, callback func(key string, value any)) {\n\tstructType := reflect.TypeFor[Options]()\n\tstructVal := reflect.ValueOf(o)\n\tfor i := 0; i < structType.NumField(); i++ {\n\t\tfieldType := structType.Field(i)\n\t\tfieldVal := structVal.Field(i)\n\t\tvalue := fieldVal.Interface()\n\n\t\tvar shouldCall bool\n\t\tswitch fieldType.Type.Kind() {\n\t\tcase reflect.Struct:","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/lib/options.go#L539-L575","documentation":"Options validation error: the setupTimeout option was set to a zero or negative duration. lib.Options.Validate collects it (alongside other validation failures) when building the test run state, because timeouts must be strictly positive durations.","triggerScenarios":"Thrown at lib/options.go:548 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set setupTimeout to a positive duration, e.g. setupTimeout: '30s' in options or --setup-timeout 30s on the CLI","Remove an explicit setupTimeout to fall back to the default instead of overriding it with 0"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}