mattermost-community/focalboard · error

No User IDs

Error message

No User IDs

What it means

GetUsersList rejects calls with an empty or nil userIDs slice. The App layer short-circuits before hitting the store, since a bulk lookup of zero IDs is meaningless. Pure input validation.

Source

Thrown at server/app/auth.go:69

	return a.store.GetActiveUserCount(secondsAgo)
}

// GetUser gets an existing active user by id.
func (a *App) GetUser(id string) (*model.User, error) {
	if len(id) < 1 {
		return nil, errors.New("no user ID")
	}

	user, err := a.store.GetUserByID(id)
	if err != nil {
		return nil, errors.Wrap(err, "unable to find user")
	}
	return user, nil
}

func (a *App) GetUsersList(userIDs []string) ([]*model.User, error) {
	if len(userIDs) == 0 {
		return nil, errors.New("No User IDs")
	}

	users, err := a.store.GetUsersList(userIDs, a.config.ShowEmailAddress, a.config.ShowFullName)
	if err != nil {
		return nil, errors.Wrap(err, "unable to find users")
	}
	return users, nil
}

// Login create a new user session if the authentication data is valid.
func (a *App) Login(username, email, password, mfaToken string) (string, error) {
	var user *model.User
	if username != "" {
		var err error
		user, err = a.store.GetUserByUsername(username)
		if err != nil && !model.IsErrNotFound(err) {
			a.metrics.IncrementLoginFailCount(1)
			return "", errors.Wrap(err, "invalid username or password")

View on GitHub (pinned to a84bbb65e3)

Solutions

  1. Check len(userIDs) == 0 before calling and return early with an empty result
  2. Ensure the upstream ID collection actually populates the slice

Example fix

// before
users, err := app.GetUsersList(ids)
// after
if len(ids) == 0 {
    users = []*model.User{}
} else {
    users, err = app.GetUsersList(ids)
}
Defensive patterns

Strategy: validation

Validate before calling

if len(userIDs) == 0 {
    return []*model.User{}, nil
}

Type guard

func hasUserIDs(ids []string) bool { return len(ids) > 0 }

Try / catch

users, err := a.GetUsersList(ids)
if err != nil {
    if err.Error() == "No User IDs" {
        users = []*model.User{}
    } else {
        return errors.Wrap(err, "get users list failed")
    }
}

Prevention

When it happens

Trigger: Calling a.GetUsersList(nil) or a.GetUsersList([]string{}) — e.g. building the ID list from board members and receiving none.

Common situations: Bulk user resolution after filtering out deleted/missing members; collectors that append user IDs into a slice left empty.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of mattermost-community/focalboard@a84bbb65e3 (2026-08-30). Data as JSON: /api/errors/27d790b31f3e17b0. Report an issue: GitHub.