{"record":{"id":"cb59af7a8c2ac804","repo":"grafana/k6","slug":"stack-cannot-be-empty","errorCode":null,"errorMessage":"stack cannot be empty","messagePattern":"stack cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/cloud_login.go","lineNumber":203,"sourceCode":"\n\t/* Stack form */\n\tstackForm := ui.Form{\n\t\tBanner: \"\\nEnter the stack where you want to run k6's commands by default.\\n\" +\n\t\t\t\"You can enter a full URL (e.g. https://my-team.grafana.net) or just the slug (e.g. my-team):\",\n\t\tFields: []ui.Field{\n\t\t\tui.StringField{\n\t\t\t\tKey:   \"Stack\",\n\t\t\t\tLabel: \"Stack\",\n\t\t\t},\n\t\t},\n\t}\n\tstackVals, err := stackForm.Run(gs.Stdin, gs.Stdout)\n\tif err != nil {\n\t\treturn userAuthForm{}, err\n\t}\n\tstack := strings.TrimSpace(stackVals[\"Stack\"])\n\tif stack == \"\" {\n\t\treturn userAuthForm{}, errors.New(\"stack cannot be empty\")\n\t}\n\n\treturn userAuthForm{token: token, stack: stack}, nil\n}\n\nfunc printConfig(gs *state.GlobalState, cloudConf cloudapi.Config) {\n\tconst notSet = \"<not set>\"\n\ttoken, stackID, stackURL, defProj := notSet, notSet, notSet, notSet\n\n\tif cloudConf.Token.String != \"\" {\n\t\ttoken = maskToken(cloudConf.Token.String)\n\t}\n\tif cloudConf.StackID.Valid {\n\t\tstackID = strconv.FormatInt(cloudConf.StackID.Int64, 10)\n\t}\n\tif cloudConf.StackURL.Valid {\n\t\tstackURL = cloudConf.StackURL.String\n\t}","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/grafana/k6/blob/9cb32757e54f84015838815076e576e857fed833/internal/cmd/cloud_login.go#L185-L221","documentation":"Raised by the interactive login flow when the user submits the stack form (second prompt after the token) with an empty or whitespace-only value. The stack selects which Grafana Cloud stack k6 commands target by default; it can be a full URL or just the slug.","triggerScenarios":"Running plain `k6 cloud login`, entering a valid token, then pressing Enter on the 'Stack' field without typing; whitespace-only input fails too after TrimSpace.","commonSituations":"Users not knowing their stack slug (it is the subdomain of your Grafana URL, e.g. my-team in https://my-team.grafana.net); paste failures; attempting to skip the prompt to 'choose later' — there is no default.","solutions":["Enter your stack slug (e.g. my-team) or full URL (https://my-team.grafana.net) — find it in your Grafana Cloud stack page","For scripting, avoid the prompt: `k6 cloud login -t <token> --stack my-team`"],"exampleFix":"# before\n> Enter the stack: <presses Enter>     # -> stack cannot be empty\n\n# after\n> Enter the stack: my-team","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Know your stack slug ahead of time: the subdomain of your Grafana URL (my-team.grafana.net -> my-team)","Full URLs are also accepted at the prompt — paste the whole https://... if unsure","Use `k6 cloud login -t <token> --stack <slug>` in scripts to avoid interactive prompts entirely"],"tags":["k6","cloud","login","interactive-prompt","stack"],"backgroundTag":"empty-user-input","analyzedSha":"9cb32757e54f84015838815076e576e857fed833","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}