{"record":{"id":"746ec0cdd946ea67","repo":"grafana/k6","slug":"stage-d-doesn-t-have-a-specified-duration","errorCode":null,"errorMessage":"stage %d doesn't have a specified duration","messagePattern":"stage (.+?) doesn't have a specified duration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/options.go","lineNumber":126,"sourceCode":"\t\tThrow:                   getNullBool(flags, \"throw\"),\n\t\tDiscardResponseBodies:   getNullBool(flags, \"discard-response-bodies\"),\n\t\tMetricSamplesBufferSize: null.NewInt(1000, false),\n\t}\n\n\t// Using Changed() because GetStringSlice() doesn't differentiate between empty and no value\n\tif flags.Changed(\"stage\") {\n\t\tstageStrings, err := flags.GetStringSlice(\"stage\")\n\t\tif err != nil {\n\t\t\treturn opts, err\n\t\t}\n\t\topts.Stages = []lib.Stage{}\n\t\tfor i, s := range stageStrings {\n\t\t\tvar stage lib.Stage\n\t\t\tif err := stage.UnmarshalText([]byte(s)); err != nil {\n\t\t\t\treturn opts, fmt.Errorf(\"error for stage %d: %w\", i, err)\n\t\t\t}\n\t\t\tif !stage.Duration.Valid {\n\t\t\t\treturn opts, fmt.Errorf(\"stage %d doesn't have a specified duration\", i)\n\t\t\t}\n\t\t\topts.Stages = append(opts.Stages, stage)\n\t\t}\n\t}\n\n\tif flags.Changed(\"execution-segment\") {\n\t\texecutionSegmentStr, err := flags.GetString(\"execution-segment\")\n\t\tif err != nil {\n\t\t\treturn opts, err\n\t\t}\n\t\tsegment := new(lib.ExecutionSegment)\n\t\terr = segment.UnmarshalText([]byte(executionSegmentStr))\n\t\tif err != nil {\n\t\t\treturn opts, err\n\t\t}\n\t\topts.ExecutionSegment = segment\n\t}\n","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/cmd/options.go#L108-L144","documentation":"Validation error for the i-th --stage value: the stage parsed but has no duration specified. Stages require a duration (e.g. '30s:10'); a target-only stage is rejected because stage length is mandatory when the stage flag is used.","triggerScenarios":"Thrown at internal/cmd/options.go:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a duration to the stage, e.g. --stage 30s:10","Use --duration for a simple constant-VU run instead of stages"],"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"}