XTLS/Xray-core · error

Email must not be empty.

Error message

Email must not be empty.

What it means

Guard error in Validator.Del: deleting a user requires a non-empty email because email is the lookup key. An empty string would otherwise be ambiguous (multiple unnamed users). Pure input-validation failure with no state change.

Source

Thrown at proxy/shadowsocks/validator.go:50

	account := u.Account.(*MemoryAccount)
	if !account.Cipher.IsAEAD() && len(v.users) > 0 {
		return errors.New("The cipher is not support Single-port Multi-user")
	}
	v.users = append(v.users, u)

	if !v.behaviorFused {
		hashkdf := hmac.New(sha256.New, []byte("SSBSKDF"))
		hashkdf.Write(account.Key)
		v.behaviorSeed = crc64.Update(v.behaviorSeed, crc64.MakeTable(crc64.ECMA), hashkdf.Sum(nil))
	}

	return nil
}

// Del a Shadowsocks user with a non-empty Email.
func (v *Validator) Del(email string) error {
	if email == "" {
		return errors.New("Email must not be empty.")
	}

	v.Lock()
	defer v.Unlock()

	email = strings.ToLower(email)
	idx := -1
	for i, u := range v.users {
		if strings.EqualFold(u.Email, email) {
			idx = i
			break
		}
	}

	if idx == -1 {
		return errors.New("User ", email, " not found.")
	}
	ulen := len(v.users)

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Supply the exact email of an existing user to Del.
  2. Fix the panel/script to validate non-empty email before calling the API.
  3. If the target user genuinely has no email, assign one first (edit user), then delete.

Example fix

// before
validator.Del("")
// after
validator.Del("alice@example.com")
Defensive patterns

Strategy: validation

Validate before calling

func delUser(v *Validator, email string) error {
  if strings.TrimSpace(email) == "" {
    return errors.New("email required to delete a user")
  }
  return v.Del(strings.TrimSpace(email))
}

Type guard

func isValidEmail(s string) bool { return strings.TrimSpace(s) != "" }

Prevention

When it happens

Trigger: Calling Validator.Del("") — typically from an API handler or panel that omitted the email field when issuing the remove-user request.

Common situations: Management panel form submitted without selecting a user; API client sending {email: ""} or omitting email; scripts iterating a user list where one entry lacks an email.

Related errors


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/91552e656233fca5. Report an issue: GitHub.