larksuite/cli · warning

please select at least one domain

Error message

please select at least one domain

What it means

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.

Source

Thrown at cmd/auth/login_interactive.go:105

		}
		options[i] = huh.NewOption(label, dm.Name)
	}

	var selectedDomains []string
	var permLevel string

	// Phase 1a: domain selection
	// Phase 1b: permission level (shown after domain selection completes)
	form1 := huh.NewForm(
		huh.NewGroup(
			huh.NewMultiSelect[string]().
				Title(msg.SelectDomains).
				Description(msg.DomainHint).
				Options(options...).
				Value(&selectedDomains).
				Validate(func(s []string) error {
					if len(s) == 0 {
						return fmt.Errorf(msg.ErrNoDomain)
					}
					return nil
				}),
		),
		huh.NewGroup(
			huh.NewSelect[string]().
				Title(msg.PermLevel).
				Options(
					huh.NewOption(msg.PermCommon, "common"),
					huh.NewOption(msg.PermAll, "all"),
				).
				Value(&permLevel),
		),
	).WithTheme(cmdutil.ThemeFeishu())

	if err := form1.Run(); err != nil {
		if err == huh.ErrUserAborted {
			return nil, output.ErrBare(1)

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. In the form, move with arrow keys and press space to select at least one domain option before pressing enter.
  2. Select all domains if unsure which are needed; scopes can be tightened later via the Lark developer console.
  3. Use the non-interactive path (flags or `config init --new` guidance) if TTY interaction is not possible.

Example fix

// before (empty selection confirmed)
Domains: (enter) -> error: please select at least one domain
// after
Domains: (arrow to domain, SPACE to mark, then enter) -> proceeds to permission level prompt
Defensive patterns

Strategy: validation

Validate before calling

// Scripted pre-check: ensure the selection payload has at least one domain
func validateDomainSelection(sel []string) error {
	if len(sel) == 0 {
		return errors.New("please select at least one domain")
	}
	return nil
}

Type guard

func hasSelection(s []string) bool { return len(s) > 0 }

Prevention

When it happens

Trigger: Running the interactive login flow (requires a TTY) and confirming the domain multi-select without marking any option with space, then pressing enter.

Common situations: New users pressing enter immediately on the form; terminals where huh keybindings are unclear; scripted input that skips selection.

Related errors


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/e2b7cff8aba7d507. Report an issue: GitHub.