glanceapp/glance · error

user has no name

Error message

user has no name

What it means

A user entry under auth.users has an empty username. Because users is parsed as a map keyed by username, this means a user record exists whose key is the empty string — typically a malformed users list item.

Source

Thrown at internal/glance/config.go:462

	}, nil
}

// TODO: Refactor, we currently validate in two different places, this being
// one of them, which doesn't modify the data and only checks for logical errors
// and then again when creating the application which does modify the data and do
// further validation. Would be better if validation was done in a single place.
func isConfigStateValid(config *config) error {
	if len(config.Pages) == 0 {
		return fmt.Errorf("no pages configured")
	}

	if len(config.Auth.Users) > 0 && config.Auth.SecretKey == "" {
		return fmt.Errorf("secret-key must be set when users are configured")
	}

	for username := range config.Auth.Users {
		if username == "" {
			return fmt.Errorf("user has no name")
		}

		if len(username) < 3 {
			return errors.New("usernames must be at least 3 characters")
		}

		user := config.Auth.Users[username]

		if user.Password == "" {
			if user.PasswordHashString == "" {
				return fmt.Errorf("user %s must have a password or a password-hash set", username)
			}
		} else if len(user.Password) < 6 {
			return fmt.Errorf("the password for %s must be at least 6 characters", username)
		}
	}

	if config.Server.AssetsPath != "" {

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Ensure each entry under auth.users has a non-empty username field
  2. Check the exact field name is username (not user or name)
  3. Verify the YAML structure matches the documented form

Example fix

# before
auth:
  users:
    - password: secret
# after
auth:
  users:
    - username: alice
      password: secret
Defensive patterns

Strategy: validation

Validate before calling

// Lint users before applying
for name := range cfg.Auth.Users {
    if name == "" {
        return errors.New("auth.users contains an entry without username")
    }
}

Prevention

When it happens

Trigger: Writing auth.users as a list of objects without username fields, or with a blank key in map form ("": {password: ...}), produces a map entry keyed by "" and trips this check.

Common situations: Copy-pasting a user block and deleting the username line; mixing up list and map syntax for users; a typo like user instead of username that silently yields an empty map key.

Related errors


AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15). Data as JSON: /api/errors/a1e70c472005d1ea. Report an issue: GitHub.