{"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/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/cmd/cloud_login.go#L185-L221","documentation":"Raised by the interactive login form's second step (Stack form): the user submitted the Stack field and, after TrimSpace, it is empty. Login requires a default stack because every subsequent cloud command needs one to route API calls.","triggerScenarios":"Running plain `k6 cloud login`, successfully entering a token, then pressing Enter on the 'Enter the stack...' prompt without typing anything.","commonSituations":"User unsure what to enter and pressing Enter to skip; paste failure; the form makes clear a full URL (https://my-team.grafana.net) or just the slug (my-team) both work.","solutions":["Re-run `k6 cloud login` and enter your stack slug (e.g. my-team) or full URL (e.g. https://my-team.grafana.net)","Find the exact value in the Grafana Cloud URL you use for the k6 app","Or bypass the prompt: `k6 cloud login --token <TOKEN> --stack my-team`"],"exampleFix":"# before\n  ? Token: eyJr...\n  ? Stack: <presses Enter empty>   # ERR: stack cannot be empty\n\n# after\n  ? Token: eyJr...\n  ? Stack: my-team   # or https://my-team.grafana.net","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Know your stack slug beforehand: it is the subdomain of your Grafana Cloud URL (my-team in my-team.grafana.net)","The form accepts either the slug or the full URL — have one of them ready before login","Use non-interactive login with --stack when automating"],"tags":["cloud","login","cli","interactive","stack"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}