{"record":{"id":"e2b7cff8aba7d507","repo":"larksuite/cli","slug":"please-select-at-least-one-domain","errorCode":null,"errorMessage":"please select at least one domain","messagePattern":"please select at least one domain","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/auth/login_interactive.go","lineNumber":105,"sourceCode":"\t\t}\n\t\toptions[i] = huh.NewOption(label, dm.Name)\n\t}\n\n\tvar selectedDomains []string\n\tvar permLevel string\n\n\t// Phase 1a: domain selection\n\t// Phase 1b: permission level (shown after domain selection completes)\n\tform1 := huh.NewForm(\n\t\thuh.NewGroup(\n\t\t\thuh.NewMultiSelect[string]().\n\t\t\t\tTitle(msg.SelectDomains).\n\t\t\t\tDescription(msg.DomainHint).\n\t\t\t\tOptions(options...).\n\t\t\t\tValue(&selectedDomains).\n\t\t\t\tValidate(func(s []string) error {\n\t\t\t\t\tif len(s) == 0 {\n\t\t\t\t\t\treturn fmt.Errorf(msg.ErrNoDomain)\n\t\t\t\t\t}\n\t\t\t\t\treturn nil\n\t\t\t\t}),\n\t\t),\n\t\thuh.NewGroup(\n\t\t\thuh.NewSelect[string]().\n\t\t\t\tTitle(msg.PermLevel).\n\t\t\t\tOptions(\n\t\t\t\t\thuh.NewOption(msg.PermCommon, \"common\"),\n\t\t\t\t\thuh.NewOption(msg.PermAll, \"all\"),\n\t\t\t\t).\n\t\t\t\tValue(&permLevel),\n\t\t),\n\t).WithTheme(cmdutil.ThemeFeishu())\n\n\tif err := form1.Run(); err != nil {\n\t\tif err == huh.ErrUserAborted {\n\t\t\treturn nil, output.ErrBare(1)","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/cmd/auth/login_interactive.go#L87-L123","documentation":"During interactive `lark-cli auth login`, the domain-selection multi-select (huh form) validates with a callback that rejects an empty selection with msg.ErrNoDomain (\"please select at least one domain\"). The form cannot advance to the permission-level step until at least one API domain is chosen.","triggerScenarios":"Running the interactive login flow (requires a TTY) and confirming the domain multi-select without marking any option with space, then pressing enter.","commonSituations":"New users pressing enter immediately on the form; terminals where huh keybindings are unclear; scripted input that skips selection.","solutions":["In the form, move with arrow keys and press space to select at least one domain option before pressing enter.","Select all domains if unsure which are needed; scopes can be tightened later via the Lark developer console.","Use the non-interactive path (flags or `config init --new` guidance) if TTY interaction is not possible."],"exampleFix":"// before (empty selection confirmed)\nDomains: (enter) -> error: please select at least one domain\n// after\nDomains: (arrow to domain, SPACE to mark, then enter) -> proceeds to permission level prompt","handlingStrategy":"validation","validationCode":"// Scripted pre-check: ensure the selection payload has at least one domain\nfunc validateDomainSelection(sel []string) error {\n\tif len(sel) == 0 {\n\t\treturn errors.New(\"please select at least one domain\")\n\t}\n\treturn nil\n}","typeGuard":"func hasSelection(s []string) bool { return len(s) > 0 }","tryCatchPattern":null,"preventionTips":["Press space (not just enter) to mark options in huh multi-selects.","Select all domains when unsure; scopes can be tightened later.","Prefer non-interactive flags when automating login.","Read the form hint text (DomainHint) before confirming."],"tags":["cli","interactive","validation","form"],"backgroundTag":"empty-selection-validation","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}