XTLS/Xray-core · error

User ${email} not found.

Error message

User ${email} not found.

What it means

Lookup failure in Validator.Del: no user in the validator matches the given email (case-insensitive comparison via strings.EqualFold after lowercasing the input). The user list was scanned, idx stayed -1, and the delete is rejected without mutating state. Commonly a stale UI list, typo, or an email that belongs to a different inbound.

Source

Thrown at proxy/shadowsocks/validator.go:66

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)

	v.users[idx] = v.users[ulen-1]
	v.users[ulen-1] = nil
	v.users = v.users[:ulen-1]

	return nil
}

// GetByEmail Get a Shadowsocks user with a non-empty Email.
func (v *Validator) GetByEmail(email string) *protocol.MemoryUser {
	if email == "" {
		return nil
	}

	v.Lock()
	defer v.Unlock()

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. List current users (panel or logs) and confirm the exact email string, including case and whitespace.
  2. If the user was already deleted, treat the error as idempotent success in automation code.
  3. Scope the delete to the correct inbound tag/handler — validators are per-inbound.

Example fix

// before
validator.Del("alice@example.com ") // trailing space -> not found
// after
validator.Del(strings.TrimSpace("alice@example.com "))
Defensive patterns

Strategy: try-catch

Validate before calling

// existence pre-check (same comparison as Validator)
func userExists(v *Validator, email string) bool {
  return v.GetByEmail(strings.ToLower(strings.TrimSpace(email))) != nil
}

Try / catch

if err := v.Del(email); err != nil {
  if strings.Contains(err.Error(), "not found") {
    return nil // idempotent delete
  }
  return err
}

Prevention

When it happens

Trigger: Calling Validator.Del with an email that is not registered in this validator: user already removed, email from another inbound's user list, whitespace/copy artifacts, or user added to a different handler instance.

Common situations: Panel showing a cached user list after another admin removed the user; API retry after a successful delete; emails differing by dots/plus-addressing or unicode; automation scripts with hardcoded emails that drift.

Related errors


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