{"record":{"id":"eb318e69a4a3bf91","repo":"grafana/k6","slug":"tests-with-unspecified-duration-are-not-allowed-wh","errorCode":null,"errorMessage":"tests with unspecified duration are not allowed when outputting data to k6 cloud","messagePattern":"tests with unspecified duration are not allowed when outputting data to k6 cloud","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/outputs_cloud.go","lineNumber":88,"sourceCode":"\tthresholds := make(map[string][]string)\n\tfor name, t := range test.derivedConfig.Thresholds {\n\t\tfor _, threshold := range t.Thresholds {\n\t\t\tthresholds[name] = append(thresholds[name], threshold.Source)\n\t\t}\n\t}\n\n\tet, err := lib.NewExecutionTuple(\n\t\ttest.derivedConfig.ExecutionSegment,\n\t\ttest.derivedConfig.ExecutionSegmentSequence,\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\texecutionPlan := test.derivedConfig.Scenarios.GetFullExecutionRequirements(et)\n\n\tduration, testEnds := lib.GetEndOffset(executionPlan)\n\tif !testEnds {\n\t\treturn errors.New(\"tests with unspecified duration are not allowed when outputting data to k6 cloud\")\n\t}\n\n\tif conf.MetricPushConcurrency.Int64 < 1 {\n\t\treturn fmt.Errorf(\"metrics push concurrency must be a positive number but is %d\",\n\t\t\tconf.MetricPushConcurrency.Int64)\n\t}\n\n\tif conf.MaxTimeSeriesInBatch.Int64 < 1 {\n\t\treturn fmt.Errorf(\"max allowed number of time series in a single batch must be a positive number but is %d\",\n\t\t\tconf.MaxTimeSeriesInBatch.Int64)\n\t}\n\n\tif conf.PushRefID.Valid && conf.PushRefID.String != \"\" {\n\t\tif err := applyExternalProvisioningCreds(gs, test, &conf); err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttest.preInitState.RuntimeOptions.Env[testRunIDKey] = conf.PushRefID.String\n\t\tgs.Logger.Debug(\"using PushRefID, skipping CreateTestRun\")","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/outputs_cloud.go#L70-L106","documentation":"Raised while creating the cloud output when lib.GetEndOffset reports that the computed execution plan never ends. The k6 Cloud service must know when a test finishes, so with `--out cloud` every scenario needs a bounded duration or end time.","triggerScenarios":"`k6 run --out cloud` (or `k6 cloud`) with an executor whose duration is unspecified, e.g. `constant-vus`/`ramping-vus` stages without `duration`, or an options set whose overall plan leaves `testEnds` false.","commonSituations":"Reusing locally-tuned options (open-ended scenarios, only `vus` set) with the cloud output; refactors that removed `duration` from a scenario; CLI overrides like `--vus 10` without `--duration` while cloud output is enabled.","solutions":["Give every scenario an explicit duration, e.g. `{ executor: 'constant-vus', vus: 10, duration: '5m' }`","Or use executors that end on their own budget: arrival-rate with `duration`, shared-iterations/per-vu-iterations with `iterations`","If an open-ended test is intentional, drop `--out cloud` and stream metrics via `--out experimental-prometheus-rw` or another output instead"],"exampleFix":"// before\nexport const options = { vus: 10 };\n\n// after\nexport const options = {\n  scenarios: { smoke: { executor: 'constant-vus', vus: 10, duration: '5m' } },\n};","handlingStrategy":"validation","validationCode":"// Verify before `k6 cloud` that every scenario is time-bounded\nfunction assertBoundedScenarios(options) {\n  const s = options?.scenarios ?? { default: options };\n  for (const [name, sc] of Object.entries(s)) {\n    const bounded = sc.duration || sc.startTime || ['shared-iterations', 'per-vu-iterations'].includes(sc.executor);\n    if (!bounded) throw new Error(`scenario '${name}' has unspecified duration; cloud output requires it`);\n  }\n}\nassertBoundedScenarios(options);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always give scenarios an explicit `duration` (or endTime) when cloud output may be used","Smoke-test `k6 inspect script.js` locally before `k6 cloud` to see the computed execution plan","Keep a CI lint that rejects options files where an executor lacks duration/iterations"],"tags":["cloud","scenarios","duration","options"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}